-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathmisc_array_to_pointer.sv
124 lines (108 loc) · 3.2 KB
/
misc_array_to_pointer.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
//==============================================================================
//
// The code is generated by Intel Compiler for SystemC, version 1.6.6
// see more information at https://github.com/intel/systemc-compiler
//
//==============================================================================
//==============================================================================
//
// Module: A ()
//
module A // "b_mod"
(
input logic clk
);
// Variables generated for SystemC signals
logic nrst;
logic signed [31:0] s;
logic signed [31:0] t0;
logic signed [31:0] t1;
logic signed [31:0] t2;
//------------------------------------------------------------------------------
// Method process: read_pointer (test_array_to_pointer.cpp:72:5)
// Process-local variables
logic signed [31:0] pp1;
logic signed [31:0] paa[3];
always_comb
begin : read_pointer // test_array_to_pointer.cpp:72:5
integer larr[3];
integer i;
i = pp1;
i = paa[1];
i = larr[1];
t0 = i;
end
//------------------------------------------------------------------------------
// Method process: read_array (test_array_to_pointer.cpp:86:5)
// Process-local variables
logic signed [31:0] arr[3][4];
logic signed [31:0] parr[3][4];
logic signed [31:0] pi[3];
logic signed [31:0] pa[3];
logic signed [31:0] pb[3];
always_comb
begin : read_array // test_array_to_pointer.cpp:86:5
integer i;
i = pi[0];
i = pa[1];
i = pb[s];
arr[0][1] = 42;
i = arr[s][s + 1] + arr[0][2];
parr[2][1] = 43;
parr[s][1] = 44;
t1 = i + parr[s][1];
end
//------------------------------------------------------------------------------
// Clocked THREAD: write_array (test_array_to_pointer.cpp:109:5)
// Thread-local variables
logic signed [31:0] pj[3];
logic signed [31:0] pj_next[3];
logic signed [31:0] pc[3];
logic signed [31:0] pc_next[3];
logic signed [31:0] pd[3];
logic signed [31:0] pd_next[3];
logic signed [31:0] t2_next;
logic write_array_PROC_STATE;
logic write_array_PROC_STATE_next;
// Next-state combinational logic
always_comb begin : write_array_comb // test_array_to_pointer.cpp:109:5
write_array_func;
end
function void write_array_func;
pc_next = pc;
pd_next = pd;
pj_next = pj;
t2_next = t2;
write_array_PROC_STATE_next = write_array_PROC_STATE;
case (write_array_PROC_STATE)
0: begin
pc_next[s] = pj_next[1];
write_array_PROC_STATE_next = 1; return; // test_array_to_pointer.cpp:118:13;
end
1: begin
pd_next[s + 1] = pc_next[1];
t2_next = pd_next[s];
pc_next[s] = pj_next[1];
write_array_PROC_STATE_next = 1; return; // test_array_to_pointer.cpp:118:13;
end
endcase
endfunction
// Synchronous register update
always_ff @(negedge clk or negedge nrst)
begin : write_array_ff
if ( ~nrst ) begin
for (integer i = 0; i < 3; i++)
begin
pj[i] <= i;
end
write_array_PROC_STATE <= 0; // test_array_to_pointer.cpp:114:9;
end
else begin
pj <= pj_next;
pc <= pc_next;
pd <= pd_next;
t2 <= t2_next;
write_array_PROC_STATE <= write_array_PROC_STATE_next;
end
end
endmodule