| 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 ce = 1'b1; |
| 10 |
|
| 11 |
wire [26:0] in_a = 27'hcafe; |
| 12 |
wire [35:0] in_b = 18'h2; |
| 13 |
wire [25:0] in_d = 26'h10; |
| 14 |
|
| 15 |
// result = (0xcafe + 0x10) * 2 = 0x1961c |
| 16 |
MULT27X36 m0 ( |
| 17 |
.DOUT(product), |
| 18 |
.A(in_a), |
| 19 |
.B(in_b), |
| 20 |
.D(in_d), |
| 21 |
.PSEL(1'b0), |
| 22 |
.PADDSUB(1'b0), |
| 23 |
.CLK({1'b0, clk}), |
| 24 |
.CE({ce, ce}), |
| 25 |
.RESET({1'b0, reset}) |
| 26 |
); |
| 27 |
|
| 28 |
defparam m0.AREG_CLK = "CLK0"; |
| 29 |
defparam m0.AREG_CE = "CE0"; |
| 30 |
defparam m0.AREG_RESET = "RESET0"; |
| 31 |
defparam m0.BREG_CLK = "CLK0"; |
| 32 |
defparam m0.BREG_CE = "CE0"; |
| 33 |
defparam m0.BREG_RESET = "RESET0"; |
| 34 |
defparam m0.DREG_CLK = "CLK0"; |
| 35 |
defparam m0.DREG_CE = "CE0"; |
| 36 |
defparam m0.DREG_RESET = "RESET0"; |
| 37 |
defparam m0.PADDSUB_IREG_CLK = "BYPASS"; |
| 38 |
defparam m0.PADDSUB_IREG_CE = "CE0"; |
| 39 |
defparam m0.PADDSUB_IREG_RESET = "RESET0"; |
| 40 |
defparam m0.PREG_CLK = "BYPASS"; |
| 41 |
defparam m0.PREG_CE = "CE0"; |
| 42 |
defparam m0.PREG_RESET = "RESET0"; |
| 43 |
defparam m0.PSEL_IREG_CLK = "BYPASS"; |
| 44 |
defparam m0.PSEL_IREG_CE = "CE0"; |
| 45 |
defparam m0.PSEL_IREG_RESET = "RESET0"; |
| 46 |
defparam m0.OREG_CLK = "CLK0"; |
| 47 |
defparam m0.OREG_CE = "CE0"; |
| 48 |
defparam m0.OREG_RESET = "RESET0"; |
| 49 |
defparam m0.MULT_RESET_MODE = "ASYNC"; |
| 50 |
defparam m0.DYN_P_SEL = "FALSE"; |
| 51 |
defparam m0.P_SEL = 1'b1; |
| 52 |
defparam m0.DYN_P_ADDSUB = "FALSE"; |
| 53 |
defparam m0.P_ADDSUB = 1'b0; |
| 54 |
|
| 55 |
|
| 56 |
// result = (0x1961c + 0x10) * 2 = 0x32c58 |
| 57 |
MULT27X36 m1 ( |
| 58 |
.DOUT(product1), |
| 59 |
.A(product[26:0]), |
| 60 |
.B(in_b), |
| 61 |
.D(in_d), |
| 62 |
.PSEL(1'b0), |
| 63 |
.PADDSUB(1'b0), |
| 64 |
.CLK({1'b0, clk}), |
| 65 |
.CE({ce, ce}), |
| 66 |
.RESET({1'b0, reset}) |
| 67 |
); |
| 68 |
|
| 69 |
defparam m1.AREG_CLK = "CLK0"; |
| 70 |
defparam m1.AREG_CE = "CE0"; |
| 71 |
defparam m1.AREG_RESET = "RESET0"; |
| 72 |
defparam m1.BREG_CLK = "CLK0"; |
| 73 |
defparam m1.BREG_CE = "CE0"; |
| 74 |
defparam m1.BREG_RESET = "RESET0"; |
| 75 |
defparam m1.DREG_CLK = "CLK0"; |
| 76 |
defparam m1.DREG_CE = "CE0"; |
| 77 |
defparam m1.DREG_RESET = "RESET0"; |
| 78 |
defparam m1.PADDSUB_IREG_CLK = "BYPASS"; |
| 79 |
defparam m1.PADDSUB_IREG_CE = "CE0"; |
| 80 |
defparam m1.PADDSUB_IREG_RESET = "RESET0"; |
| 81 |
defparam m1.PREG_CLK = "BYPASS"; |
| 82 |
defparam m1.PREG_CE = "CE0"; |
| 83 |
defparam m1.PREG_RESET = "RESET0"; |
| 84 |
defparam m1.PSEL_IREG_CLK = "BYPASS"; |
| 85 |
defparam m1.PSEL_IREG_CE = "CE0"; |
| 86 |
defparam m1.PSEL_IREG_RESET = "RESET0"; |
| 87 |
defparam m1.OREG_CLK = "CLK0"; |
| 88 |
defparam m1.OREG_CE = "CE0"; |
| 89 |
defparam m1.OREG_RESET = "RESET0"; |
| 90 |
defparam m1.MULT_RESET_MODE = "ASYNC"; |
| 91 |
defparam m1.DYN_P_SEL = "FALSE"; |
| 92 |
defparam m1.P_SEL = 1'b1; |
| 93 |
defparam m1.DYN_P_ADDSUB = "FALSE"; |
| 94 |
defparam m1.P_ADDSUB = 1'b0; |
| 95 |
|
| 96 |
// result = (0xcafe + 0x100) * 2 = 0x197fc |
| 97 |
MULT27X36 m2 ( |
| 98 |
.DOUT(product2), |
| 99 |
.A(in_a), |
| 100 |
.B(in_b), |
| 101 |
.D(26'h100), |
| 102 |
.PSEL(1'b0), |
| 103 |
.PADDSUB(1'b0), |
| 104 |
.CLK({1'b0, clk}), |
| 105 |
.CE({ce, ce}), |
| 106 |
.RESET({1'b0, reset}) |
| 107 |
); |
| 108 |
|
| 109 |
defparam m2.AREG_CLK = "CLK0"; |
| 110 |
defparam m2.AREG_CE = "CE0"; |
| 111 |
defparam m2.AREG_RESET = "RESET0"; |
| 112 |
defparam m2.BREG_CLK = "CLK0"; |
| 113 |
defparam m2.BREG_CE = "CE0"; |
| 114 |
defparam m2.BREG_RESET = "RESET0"; |
| 115 |
defparam m2.DREG_CLK = "CLK0"; |
| 116 |
defparam m2.DREG_CE = "CE0"; |
| 117 |
defparam m2.DREG_RESET = "RESET0"; |
| 118 |
defparam m2.PADDSUB_IREG_CLK = "BYPASS"; |
| 119 |
defparam m2.PADDSUB_IREG_CE = "CE0"; |
| 120 |
defparam m2.PADDSUB_IREG_RESET = "RESET0"; |
| 121 |
defparam m2.PREG_CLK = "BYPASS"; |
| 122 |
defparam m2.PREG_CE = "CE0"; |
| 123 |
defparam m2.PREG_RESET = "RESET0"; |
| 124 |
defparam m2.PSEL_IREG_CLK = "BYPASS"; |
| 125 |
defparam m2.PSEL_IREG_CE = "CE0"; |
| 126 |
defparam m2.PSEL_IREG_RESET = "RESET0"; |
| 127 |
defparam m2.OREG_CLK = "CLK0"; |
| 128 |
defparam m2.OREG_CE = "CE0"; |
| 129 |
defparam m2.OREG_RESET = "RESET0"; |
| 130 |
defparam m2.MULT_RESET_MODE = "ASYNC"; |
| 131 |
defparam m2.DYN_P_SEL = "FALSE"; |
| 132 |
defparam m2.P_SEL = 1'b1; |
| 133 |
defparam m2.DYN_P_ADDSUB = "FALSE"; |
| 134 |
defparam m2.P_ADDSUB = 1'b0; |
| 135 |
|
| 136 |
// result (0xcafe + 0x5) * 0x100 = 0xcb0300 |
| 137 |
MULT27X36 m3 ( |
| 138 |
.DOUT(product3), |
| 139 |
.A(in_a), |
| 140 |
.B(36'h100), |
| 141 |
.D(26'h5), |
| 142 |
.PSEL(1'b0), |
| 143 |
.PADDSUB(1'b0), |
| 144 |
.CLK({1'b0, clk}), |
| 145 |
.CE({ce, ce}), |
| 146 |
.RESET({1'b0, reset}) |
| 147 |
); |
| 148 |
|
| 149 |
defparam m3.AREG_CLK = "CLK0"; |
| 150 |
defparam m3.AREG_CE = "CE0"; |
| 151 |
defparam m3.AREG_RESET = "RESET0"; |
| 152 |
defparam m3.BREG_CLK = "CLK0"; |
| 153 |
defparam m3.BREG_CE = "CE0"; |
| 154 |
defparam m3.BREG_RESET = "RESET0"; |
| 155 |
defparam m3.DREG_CLK = "CLK0"; |
| 156 |
defparam m3.DREG_CE = "CE0"; |
| 157 |
defparam m3.DREG_RESET = "RESET0"; |
| 158 |
defparam m3.PADDSUB_IREG_CLK = "BYPASS"; |
| 159 |
defparam m3.PADDSUB_IREG_CE = "CE0"; |
| 160 |
defparam m3.PADDSUB_IREG_RESET = "RESET0"; |
| 161 |
defparam m3.PREG_CLK = "BYPASS"; |
| 162 |
defparam m3.PREG_CE = "CE0"; |
| 163 |
defparam m3.PREG_RESET = "RESET0"; |
| 164 |
defparam m3.PSEL_IREG_CLK = "BYPASS"; |
| 165 |
defparam m3.PSEL_IREG_CE = "CE0"; |
| 166 |
defparam m3.PSEL_IREG_RESET = "RESET0"; |
| 167 |
defparam m3.OREG_CLK = "CLK0"; |
| 168 |
defparam m3.OREG_CE = "CE0"; |
| 169 |
defparam m3.OREG_RESET = "RESET0"; |
| 170 |
defparam m3.MULT_RESET_MODE = "ASYNC"; |
| 171 |
defparam m3.DYN_P_SEL = "FALSE"; |
| 172 |
defparam m3.P_SEL = 1'b1; |
| 173 |
defparam m3.DYN_P_ADDSUB = "FALSE"; |
| 174 |
defparam m3.P_ADDSUB = 1'b0; |
| 175 |
|
| 176 |
// result = 0xcb0300 + 0x123 = 0xcb0423 |
| 177 |
MULT27X36 m4 ( |
| 178 |
.DOUT(product4), |
| 179 |
.A(product3[26:0]), |
| 180 |
.B(36'h1), |
| 181 |
.D(26'h123), |
| 182 |
.PSEL(1'b0), |
| 183 |
.PADDSUB(1'b0), |
| 184 |
.CLK({1'b0, clk}), |
| 185 |
.CE({ce, ce}), |
| 186 |
.RESET({1'b0, reset}) |
| 187 |
); |
| 188 |
|
| 189 |
defparam m4.AREG_CLK = "CLK0"; |
| 190 |
defparam m4.AREG_CE = "CE0"; |
| 191 |
defparam m4.AREG_RESET = "RESET0"; |
| 192 |
defparam m4.BREG_CLK = "CLK0"; |
| 193 |
defparam m4.BREG_CE = "CE0"; |
| 194 |
defparam m4.BREG_RESET = "RESET0"; |
| 195 |
defparam m4.DREG_CLK = "CLK0"; |
| 196 |
defparam m4.DREG_CE = "CE0"; |
| 197 |
defparam m4.DREG_RESET = "RESET0"; |
| 198 |
defparam m4.PADDSUB_IREG_CLK = "BYPASS"; |
| 199 |
defparam m4.PADDSUB_IREG_CE = "CE0"; |
| 200 |
defparam m4.PADDSUB_IREG_RESET = "RESET0"; |
| 201 |
defparam m4.PREG_CLK = "BYPASS"; |
| 202 |
defparam m4.PREG_CE = "CE0"; |
| 203 |
defparam m4.PREG_RESET = "RESET0"; |
| 204 |
defparam m4.PSEL_IREG_CLK = "BYPASS"; |
| 205 |
defparam m4.PSEL_IREG_CE = "CE0"; |
| 206 |
defparam m4.PSEL_IREG_RESET = "RESET0"; |
| 207 |
defparam m4.OREG_CLK = "CLK0"; |
| 208 |
defparam m4.OREG_CE = "CE0"; |
| 209 |
defparam m4.OREG_RESET = "RESET0"; |
| 210 |
defparam m4.MULT_RESET_MODE = "ASYNC"; |
| 211 |
defparam m4.DYN_P_SEL = "FALSE"; |
| 212 |
defparam m4.P_SEL = 1'b1; |
| 213 |
defparam m4.DYN_P_ADDSUB = "FALSE"; |
| 214 |
defparam m4.P_ADDSUB = 1'b0; |
| 215 |
|
| 216 |
endmodule |
| 217 |
|
| 218 |
`define FIRMWARE "../riscv-firmware/mult27x36.hex" |
| 219 |
`include "dsp-riscv.v" |
| 220 |
|