-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathmisc_sc_vector2.sv
176 lines (151 loc) · 4.22 KB
/
misc_sc_vector2.sv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
//==============================================================================
//
// The code is generated by Intel Compiler for SystemC, version 1.6.6
// see more information at https://github.com/intel/systemc-compiler
//
//==============================================================================
//==============================================================================
//
// Module: Top ()
//
module Top // "top"
(
input logic clk
);
// Variables generated for SystemC signals
logic rstn;
logic req[3];
logic [15:0] data[3];
logic signed [31:0] req2D[3][2];
// Local parameters generated for C++ constants
localparam logic [31:0] N = 3;
//------------------------------------------------------------------------------
// Clocked THREAD: mainProc (test_sc_vector2.cpp:95:5)
// Thread-local variables
logic req_next[3];
logic [1:0] mainProc_PROC_STATE;
logic [1:0] mainProc_PROC_STATE_next;
// Next-state combinational logic
always_comb begin : mainProc_comb // test_sc_vector2.cpp:95:5
mainProc_func;
end
function void mainProc_func;
req_next = req;
mainProc_PROC_STATE_next = mainProc_PROC_STATE;
case (mainProc_PROC_STATE)
0: begin
req_next[0] = 1;
mainProc_PROC_STATE_next = 1; return; // test_sc_vector2.cpp:104:13;
end
1: begin
req_next[0] = 0;
if (!(|data[1]))
begin
mainProc_PROC_STATE_next = 2; return; // test_sc_vector2.cpp:107:37;
end
req_next[1] = 1;
mainProc_PROC_STATE_next = 3; return; // test_sc_vector2.cpp:109:13;
end
2: begin
if (!(|data[1]))
begin
mainProc_PROC_STATE_next = 2; return; // test_sc_vector2.cpp:107:37;
end
req_next[1] = 1;
mainProc_PROC_STATE_next = 3; return; // test_sc_vector2.cpp:109:13;
end
3: begin
req_next[1] = 0;
req_next[0] = 1;
mainProc_PROC_STATE_next = 1; return; // test_sc_vector2.cpp:104:13;
end
endcase
endfunction
// Synchronous register update
always_ff @(posedge clk or negedge rstn)
begin : mainProc_ff
if ( ~rstn ) begin
for (integer i = 1; i < N; ++i)
begin
req[i] <= 0;
req2D[i][0] <= i;
end
mainProc_PROC_STATE <= 0; // test_sc_vector2.cpp:100:9;
end
else begin
req <= req_next;
mainProc_PROC_STATE <= mainProc_PROC_STATE_next;
end
end
//------------------------------------------------------------------------------
// Child module instances
Producer p
(
.clk(clk),
.rstn(rstn),
.req(req),
.data(data),
.req2D(req2D)
);
endmodule
//==============================================================================
//
// Module: Producer (test_sc_vector2.cpp:77:5)
//
module Producer // "top.p"
(
input logic clk,
input logic rstn,
input logic req[3],
output logic [15:0] data[3],
input logic signed [31:0] req2D[3][2]
);
// Variables generated for SystemC signals
logic greq;
//------------------------------------------------------------------------------
// Method process: methProc (test_sc_vector2.cpp:40:5)
always_comb
begin : methProc // test_sc_vector2.cpp:40:5
logic a;
a = 0;
for (integer i = 0; i < 3; ++i)
begin
a = a || req[i] || |req2D[i][0];
end
greq = a;
end
//------------------------------------------------------------------------------
// Clocked THREAD: threadProc (test_sc_vector2.cpp:49:5)
// Thread-local variables
logic [15:0] data_next[3];
logic [3:0] n;
logic [3:0] n_next;
// Next-state combinational logic
always_comb begin : threadProc_comb // test_sc_vector2.cpp:49:5
threadProc_func;
end
function void threadProc_func;
data_next = data;
n_next = n;
if (greq)
begin
for (integer i = 1; i < 3; ++i)
begin
data_next[i] = data[i - 1];
end
end
data_next[0] = n_next++;
endfunction
// Synchronous register update
always_ff @(posedge clk or negedge rstn)
begin : threadProc_ff
if ( ~rstn ) begin
n <= 1;
data[0] <= 0;
end
else begin
data <= data_next;
n <= n_next;
end
end
endmodule