Debian Codegraph @

examples/gw5a/dsp-multaddalu12x12.v

raw
1 `default_nettype none
2 module idsp(input wire clk, input wire reset, input wire key,
3 output wire [63:0] product,
4 output wire [63:0] product1,
5 output wire [63:0] product2,
6 output wire [63:0] product3,
7 output wire [63:0] product4);
8
9 wire gnd = 1'b0;
10
11 wire [11:0] in_a0 = 12'h3;
12 wire [11:0] in_b0 = 12'h4;
13 wire [11:0] in_a1 = 12'h2;
14 wire [11:0] in_b1 = 12'h5;
15 wire [47:0] cas[4];
16
17 MULTADDALU12X12 m0(
18 .A0(in_a0),
19 .B0(in_b0),
20 .A1(in_a1),
21 .B1(in_b1),
22 .CASI(),
23 .CASISEL(1'b0),
24 .ADDSUB(2'b00),
25 .ACCSEL(key),
26 .CLK({clk, clk}),
27 .CE(2'b11),
28 .RESET({1'b0, reset}),
29 .DOUT(product),
30 .CASO(cas[0])
31 );
32 defparam m0.A0REG_CLK="CLK0";
33 defparam m0.B0REG_CLK="CLK1";
34 defparam m0.A1REG_CLK="CLK0";
35 defparam m0.B1REG_CLK="CLK1";
36 defparam m0.ADDSUB0_IREG_CLK="CLK0";
37 defparam m0.ADDSUB1_PREG_CLK="CLK0";
38 defparam m0.CASISEL_PREG_CLK="CLK1";
39 defparam m0.PREG0_CLK="CLK0";
40 defparam m0.FB_PREG_EN="TRUE";
41 defparam m0.OREG_CLK="CLK1";
42 defparam m0.OREG_CE="CE1";
43 defparam m0.OREG_RESET="RESET1";
44 defparam m0.MULT_RESET_MODE="ASYNC";
45 defparam m0.DYN_ACC_SEL="TRUE";
46 defparam m0.DYN_ACC_SEL="TRUE";
47 defparam m0.DYN_ADD_SUB_0="TRUE";
48 defparam m0.DYN_ADD_SUB_1="TRUE";
49
50 MULTADDALU12X12 m1(
51 .A0(12'h1),
52 .B0(12'h2),
53 .A1(12'h3),
54 .B1(12'h4),
55 .CASI(cas[0]),
56 .CASISEL(),
57 .ADDSUB(2'b01),
58 .ACCSEL(key),
59 .CLK({clk, clk}),
60 .CE(2'b11),
61 .RESET({1'b0, reset}),
62 .DOUT(product1),
63 .CASO(cas[1])
64 );
65 defparam m1.A0REG_CLK="CLK0";
66 defparam m1.B0REG_CLK="CLK1";
67 defparam m1.A1REG_CLK="CLK0";
68 defparam m1.B1REG_CLK="CLK1";
69 defparam m1.ADDSUB0_IREG_CLK="CLK0";
70 defparam m1.ADDSUB1_PREG_CLK="CLK0";
71 defparam m1.CASISEL_PREG_CLK="CLK1";
72 defparam m1.CASI_SEL=1'b1;
73 defparam m1.DYN_CASI_SEL="FALSE";
74 defparam m1.PREG0_CLK="CLK0";
75 defparam m1.FB_PREG_EN="TRUE";
76 defparam m1.OREG_CLK="CLK1";
77 defparam m1.OREG_CE="CE1";
78 defparam m1.OREG_RESET="RESET1";
79 defparam m1.MULT_RESET_MODE="ASYNC";
80 defparam m1.DYN_ACC_SEL="TRUE";
81 defparam m1.PRE_LOAD=48'h00000000cafe;
82
83 MULTADDALU12X12 m2(
84 .A0(in_a0),
85 .B0(in_b0),
86 .A1(in_a1),
87 .B1(in_b1),
88 .CASI(cas[1]),
89 .CASISEL(),
90 .ADDSUB(2'b01),
91 .ACCSEL(key),
92 .CLK({clk, clk}),
93 .CE(2'b11),
94 .RESET({1'b0, reset}),
95 .DOUT(product2),
96 .CASO(cas[2])
97 );
98 defparam m2.A0REG_CLK="CLK0";
99 defparam m2.B0REG_CLK="CLK1";
100 defparam m2.A1REG_CLK="CLK0";
101 defparam m2.B1REG_CLK="CLK1";
102 defparam m2.ADDSUB0_IREG_CLK="CLK0";
103 defparam m2.ADDSUB1_PREG_CLK="CLK0";
104 defparam m2.CASISEL_PREG_CLK="CLK1";
105 defparam m2.CASI_SEL=1'b1;
106 defparam m2.DYN_CASI_SEL="FALSE";
107 defparam m2.PREG0_CLK="CLK0";
108 defparam m2.FB_PREG_EN="TRUE";
109 defparam m2.OREG_CLK="CLK1";
110 defparam m2.OREG_CE="CE1";
111 defparam m2.OREG_RESET="RESET1";
112 defparam m2.MULT_RESET_MODE="ASYNC";
113 defparam m2.DYN_ACC_SEL="FALSE";
114 defparam m2.ACC_SEL=1'b1;
115
116 MULTADDALU12X12 m3(
117 .A0(in_a0),
118 .B0(in_b0),
119 .A1(in_a1),
120 .B1(in_b1),
121 .CASI(cas[2]),
122 .CASISEL(),
123 .ADDSUB(2'b01),
124 .ACCSEL(key),
125 .CLK({clk, clk}),
126 .CE(2'b11),
127 .RESET({1'b0, reset}),
128 .DOUT(product3),
129 .CASO(cas[3])
130 );
131 defparam m3.A0REG_CLK="CLK0";
132 defparam m3.B0REG_CLK="CLK1";
133 defparam m3.A1REG_CLK="CLK0";
134 defparam m3.B1REG_CLK="CLK1";
135 defparam m3.ADDSUB0_IREG_CLK="CLK0";
136 defparam m3.ADDSUB1_PREG_CLK="CLK0";
137 defparam m3.CASISEL_PREG_CLK="CLK1";
138 defparam m3.CASI_SEL=1'b1;
139 defparam m3.DYN_CASI_SEL="FALSE";
140 defparam m3.PREG0_CLK="CLK0";
141 defparam m3.FB_PREG_EN="TRUE";
142 defparam m3.OREG_CLK="CLK1";
143 defparam m3.OREG_CE="CE1";
144 defparam m3.OREG_RESET="RESET1";
145 defparam m3.MULT_RESET_MODE="ASYNC";
146 defparam m3.DYN_ACC_SEL="FALSE";
147 defparam m3.ACC_SEL=1'b0;
148 defparam m3.PRE_LOAD=48'h000000000002;
149
150 MULTADDALU12X12 m4(
151 .A0(in_a0),
152 .B0(in_b0),
153 .A1(in_a1),
154 .B1(in_b1),
155 .CASI(cas[3]),
156 .CASISEL(1'b1),
157 .ADDSUB(2'b01),
158 .ACCSEL(key),
159 .CLK({clk, clk}),
160 .CE(2'b11),
161 .RESET({1'b0, reset}),
162 .DOUT(product4),
163 .CASO()
164 );
165 defparam m4.A0REG_CLK="CLK0";
166 defparam m4.B0REG_CLK="CLK1";
167 defparam m4.A1REG_CLK="CLK0";
168 defparam m4.B1REG_CLK="CLK1";
169 defparam m4.ADDSUB0_IREG_CLK="CLK0";
170 defparam m4.ADDSUB1_PREG_CLK="CLK0";
171 defparam m4.CASISEL_PREG_CLK="CLK1";
172 defparam m4.DYN_CASI_SEL="TRUE";
173 defparam m4.PREG0_CLK="CLK0";
174 defparam m4.FB_PREG_EN="TRUE";
175 defparam m4.OREG_CLK="CLK1";
176 defparam m4.OREG_CE="CE1";
177 defparam m4.OREG_RESET="RESET1";
178 defparam m4.MULT_RESET_MODE="ASYNC";
179 defparam m4.DYN_ACC_SEL="FALSE";
180 defparam m4.ACC_SEL=1'b0;
181 defparam m4.PRE_LOAD=48'h000000000002;
182 endmodule
183
184 `define FIRMWARE "../riscv-firmware/multaddalu12x12.hex"
185 `include "dsp-riscv.v"
186