Debian Codegraph @

examples/dsp-mult9x9.v

raw
1 `default_nettype none
2 // A is distributed along the chain, the registers are turned on, since this
3 // is a multiplication, then until A reaches a specific multiplier, the
4 // product will be equal to 0
5
6 module idsp(input wire clk, input wire reset,
7 output wire [63:0] product,
8 output wire [63:0] product1,
9 output wire [63:0] product2,
10 output wire [63:0] product3,
11 output wire [63:0] product4);
12
13 wire [8:0] soa;
14 wire [8:0] sob;
15 wire [8:0] soa0;
16 wire [8:0] sob0;
17 wire [8:0] soa1;
18 wire [8:0] sob1;
19 wire [8:0] soa2;
20 wire [8:0] sob2;
21 wire gnd = 1'b0;
22
23 MULT9X9 mult_0(
24 .A({9'h123}),
25 .B({9'hfd}),
26 .SIA({9{gnd}}),
27 .SIB({9{gnd}}),
28 .ASIGN(gnd),
29 .BSIGN(gnd),
30 .ASEL(gnd),
31 .BSEL(gnd),
32 .CE(1'b1),
33 .CLK(clk),
34 .RESET(reset),
35 .SOA(soa),
36 .SOB(sob),
37 .DOUT(product[17:0])
38 );
39 defparam mult_0.AREG=1'b1;
40 defparam mult_0.BREG=1'b1;
41 defparam mult_0.OUT_REG=1'b0;
42 defparam mult_0.PIPE_REG=1'b0;
43 defparam mult_0.ASIGN_REG=1'b0;
44 defparam mult_0.BSIGN_REG=1'b0;
45 defparam mult_0.SOA_REG=1'b0;
46 defparam mult_0.MULT_RESET_MODE="SYNC";
47
48 MULT9X9 mult_1(
49 .A({9'h2}),
50 .B({9'h2}),
51 .SIA(soa),
52 .SIB(sob),
53 .ASIGN(gnd),
54 .BSIGN(gnd),
55 .ASEL(1'b1),
56 .BSEL(gnd),
57 .CE(1'b1),
58 .CLK(clk),
59 .RESET(reset),
60 .SOA(soa0),
61 .SOB(sob0),
62 .DOUT(product1[17:0])
63 );
64 defparam mult_1.AREG=1'b1;
65 defparam mult_1.BREG=1'b1;
66 defparam mult_1.OUT_REG=1'b1;
67 defparam mult_1.PIPE_REG=1'b0;
68 defparam mult_1.ASIGN_REG=1'b0;
69 defparam mult_1.BSIGN_REG=1'b0;
70 defparam mult_1.SOA_REG=1'b1;
71 defparam mult_1.MULT_RESET_MODE="SYNC";
72
73 MULT9X9 mult_2(
74 .A({9'h4}),
75 .B({9'h4}),
76 .SIA(soa0),
77 .SIB(sob0),
78 .ASIGN(gnd),
79 .BSIGN(gnd),
80 .ASEL(1'b1),
81 .BSEL(gnd),
82 .CE(1'b1),
83 .CLK(clk),
84 .RESET(reset),
85 .SOA(soa1),
86 .SOB(sob1),
87 .DOUT(product2[17:0])
88 );
89 defparam mult_2.AREG=1'b1;
90 defparam mult_2.BREG=1'b1;
91 defparam mult_2.OUT_REG=1'b0;
92 defparam mult_2.PIPE_REG=1'b0;
93 defparam mult_2.ASIGN_REG=1'b0;
94 defparam mult_2.BSIGN_REG=1'b0;
95 defparam mult_2.SOA_REG=1'b0;
96 defparam mult_2.MULT_RESET_MODE="SYNC";
97
98 MULT9X9 mult_3(
99 .A({9'h4}),
100 .B({9'h5}),
101 .SIA(soa1),
102 .SIB(sob1),
103 .ASIGN(gnd),
104 .BSIGN(gnd),
105 .ASEL(1'b1),
106 .BSEL(gnd),
107 .CE(1'b1),
108 .CLK(clk),
109 .RESET(reset),
110 .SOA(soa2),
111 .SOB(sob2),
112 .DOUT(product3[17:0])
113 );
114 defparam mult_3.AREG=1'b1;
115 defparam mult_3.BREG=1'b1;
116 defparam mult_3.OUT_REG=1'b0;
117 defparam mult_3.PIPE_REG=1'b0;
118 defparam mult_3.ASIGN_REG=1'b0;
119 defparam mult_3.BSIGN_REG=1'b0;
120 defparam mult_3.SOA_REG=1'b1;
121 defparam mult_3.MULT_RESET_MODE="SYNC";
122
123 MULT9X9 mult_4(
124 .A({9'h4}),
125 .B({9'h6}),
126 .SIA(soa2),
127 .SIB(sob2),
128 .ASIGN(gnd),
129 .BSIGN(gnd),
130 .ASEL(1'b1),
131 .BSEL(gnd),
132 .CE(1'b1),
133 .CLK(clk),
134 .RESET(reset),
135 .SOA(),
136 .SOB(),
137 .DOUT(product4[17:0])
138 );
139 defparam mult_4.AREG=1'b1;
140 defparam mult_4.BREG=1'b1;
141 defparam mult_4.OUT_REG=1'b1;
142 defparam mult_4.PIPE_REG=1'b0;
143 defparam mult_4.ASIGN_REG=1'b0;
144 defparam mult_4.BSIGN_REG=1'b0;
145 defparam mult_4.SOA_REG=1'b0;
146 defparam mult_4.MULT_RESET_MODE="SYNC";
147 endmodule
148
149 `define FIRMWARE "riscv-firmware/mult9x9.hex"
150 `include "dsp-riscv.v"
151