-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathmisc_fcall_params.sv
163 lines (144 loc) · 3.93 KB
/
misc_fcall_params.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
//==============================================================================
//
// The code is generated by Intel Compiler for SystemC, version 1.6.6
// see more information at https://github.com/intel/systemc-compiler
//
//==============================================================================
//==============================================================================
//
// Module: B ()
//
module B // "b_mod"
(
input logic clk
);
// Variables generated for SystemC signals
logic op_next[2];
logic op_en[2];
logic signed [15:0] sin_lane[2];
logic signed [15:0] cos_lane[2];
//------------------------------------------------------------------------------
// Child module instances
A a_mod_0
(
.clk(clk),
.sin_lane(sin_lane[0]),
.cos_lane(cos_lane[0]),
.op_enable(op_en[0]),
.next_op(op_next[0]),
.op_enable_out(op_en[0]),
.next_op_out(op_next[0])
);
A a_mod_1
(
.clk(clk),
.sin_lane(sin_lane[1]),
.cos_lane(cos_lane[1]),
.op_enable(op_en[1]),
.next_op(op_next[1]),
.op_enable_out(op_en[1]),
.next_op_out(op_next[1])
);
endmodule
//==============================================================================
//
// Module: A ()
//
module A // "b_mod.a"
(
input logic clk,
output logic signed [15:0] sin_lane,
output logic signed [15:0] cos_lane,
input logic op_enable,
input logic next_op,
output logic op_enable_out,
output logic next_op_out
);
// Variables generated for SystemC signals
logic nrst;
logic [9:0] nco_data;
// Local parameters generated for C++ constants
localparam logic signed [31:0] sin_tab[4] = '{ 1, 2, 3, 4 };
localparam logic signed [31:0] cos_tab[4] = '{ 1, 2, 3, 4 };
//------------------------------------------------------------------------------
// Clocked THREAD: fcall_param_thread (test_fcall_params.cpp:84:5)
// Thread-local variables
logic signed [15:0] sin_lane_next;
logic signed [15:0] cos_lane_next;
logic op_enable_out_next;
logic next_op_out_next;
// Next-state combinational logic
always_comb begin : fcall_param_thread_comb // test_fcall_params.cpp:84:5
fcall_param_thread_func;
end
function void fcall_param_thread_func;
integer unsigned idx;
integer unsigned new_idx;
integer unsigned quadrant;
integer sin_val;
integer cos_val;
integer res_sin;
integer res_cos;
integer TMP_0_sin;
integer TMP_0_cos;
integer conv_res_sin;
integer conv_res_cos;
cos_lane_next = cos_lane;
next_op_out_next = next_op_out;
op_enable_out_next = op_enable_out;
sin_lane_next = sin_lane;
op_enable_out_next = op_enable;
next_op_out_next = next_op;
if (op_enable)
begin
idx = nco_data;
// Call convert_sin_cos() begin
new_idx = idx & 255;
quadrant = idx / 256;
sin_val = sin_tab[new_idx];
cos_val = cos_tab[new_idx];
case (quadrant)
0 : begin
res_cos = cos_val;
res_sin = sin_val;
end
1 : begin
res_cos = -sin_val;
res_sin = cos_val;
end
2 : begin
res_cos = -cos_val;
res_sin = -sin_val;
end
3 : begin
res_cos = sin_val;
res_sin = -cos_val;
end
endcase
TMP_0_sin = res_sin; TMP_0_cos = res_cos;
// Call convert_sin_cos() end
conv_res_sin = TMP_0_sin; conv_res_cos = TMP_0_cos;
sin_lane_next = conv_res_sin;
cos_lane_next = conv_res_cos;
end else begin
sin_lane_next = 0;
cos_lane_next = 0;
end
endfunction
// Synchronous register update
always_ff @(posedge clk or negedge nrst)
begin : fcall_param_thread_ff
if ( ~nrst ) begin
sin_lane <= 0;
cos_lane <= 0;
op_enable_out <= 0;
next_op_out <= 0;
end
else begin
sin_lane <= sin_lane_next;
cos_lane <= cos_lane_next;
op_enable_out <= op_enable_out_next;
next_op_out <= next_op_out_next;
end
end
endmodule