| 1 |
`default_nettype none |
| 2 |
// In all primitives except the last one, B is set as SBI, the registers on |
| 3 |
// B are turned on so that at the initial moment everywhere A is added to 0, |
| 4 |
// and then 0xd propagates from the last PADD to the first. |
| 5 |
// I did not redo the byte output procedure so that 0x038000 has 18 |
| 6 |
// significant bits and if we consider it as a signed number it is -0x8000 --- |
| 7 |
// what happens when A=0xf12 reaches the N2 primitive and 0x8f12 is subtracted |
| 8 |
// from it. |
| 9 |
|
| 10 |
module idsp(input wire clk, input wire reset, |
| 11 |
output wire [63:0] product, |
| 12 |
output wire [63:0] product1, |
| 13 |
output wire [63:0] product2, |
| 14 |
output wire [63:0] product3, |
| 15 |
output wire [63:0] product4); |
| 16 |
|
| 17 |
wire [8:0] sob; |
| 18 |
wire [8:0] sob0; |
| 19 |
wire [8:0] sob1; |
| 20 |
wire [8:0] sob2; |
| 21 |
wire gnd = 1'b0; |
| 22 |
|
| 23 |
PADD9 padd_0( |
| 24 |
.A({9'h1}), |
| 25 |
.B({9'h6}), |
| 26 |
.SI({9{gnd}}), |
| 27 |
.SBI(sob), |
| 28 |
.ASEL(gnd), |
| 29 |
.CE(1'b1), |
| 30 |
.CLK(clk), |
| 31 |
.RESET(reset), |
| 32 |
.SO(), |
| 33 |
.SBO(), |
| 34 |
.DOUT(product[8:0]) |
| 35 |
); |
| 36 |
defparam padd_0.AREG=1'b0; |
| 37 |
defparam padd_0.BREG=1'b1; |
| 38 |
defparam padd_0.ADD_SUB=1'b0; |
| 39 |
defparam padd_0.BSEL_MODE=1'b1; |
| 40 |
defparam padd_0.SOREG=1'b0; |
| 41 |
defparam padd_0.PADD_RESET_MODE="SYNC"; |
| 42 |
|
| 43 |
PADD9 padd_1( |
| 44 |
.A({9'h2}), |
| 45 |
.B({9'h5}), |
| 46 |
.SI({9{gnd}}), |
| 47 |
.SBI(sob0), |
| 48 |
.ASEL(gnd), |
| 49 |
.CE(1'b1), |
| 50 |
.CLK(clk), |
| 51 |
.RESET(reset), |
| 52 |
.SO(), |
| 53 |
.SBO(sob), |
| 54 |
.DOUT(product1[8:0]) |
| 55 |
); |
| 56 |
defparam padd_1.AREG=1'b0; |
| 57 |
defparam padd_1.BREG=1'b1; |
| 58 |
defparam padd_1.ADD_SUB=1'b0; |
| 59 |
defparam padd_1.BSEL_MODE=1'b1; |
| 60 |
defparam padd_1.SOREG=1'b0; |
| 61 |
defparam padd_1.PADD_RESET_MODE="SYNC"; |
| 62 |
|
| 63 |
PADD9 padd_2( |
| 64 |
.A({9'h3}), |
| 65 |
.B({9'h4}), |
| 66 |
.SI({9{gnd}}), |
| 67 |
.SBI(sob1), |
| 68 |
.ASEL(gnd), |
| 69 |
.CE(1'b1), |
| 70 |
.CLK(clk), |
| 71 |
.RESET(reset), |
| 72 |
.SO(), |
| 73 |
.SBO(sob0), |
| 74 |
.DOUT(product2[8:0]) |
| 75 |
); |
| 76 |
defparam padd_2.AREG=1'b0; |
| 77 |
defparam padd_2.BREG=1'b1; |
| 78 |
defparam padd_2.ADD_SUB=1'b0; |
| 79 |
defparam padd_2.BSEL_MODE=1'b1; |
| 80 |
defparam padd_2.SOREG=1'b0; |
| 81 |
defparam padd_2.PADD_RESET_MODE="SYNC"; |
| 82 |
|
| 83 |
PADD9 padd_3( |
| 84 |
.A({9'h4}), |
| 85 |
.B({9'h3}), |
| 86 |
.SI({9{gnd}}), |
| 87 |
.SBI(sob2), |
| 88 |
.ASEL(gnd), |
| 89 |
.CE(1'b1), |
| 90 |
.CLK(clk), |
| 91 |
.RESET(reset), |
| 92 |
.SO(), |
| 93 |
.SBO(sob1), |
| 94 |
.DOUT(product3[8:0]) |
| 95 |
); |
| 96 |
defparam padd_3.AREG=1'b0; |
| 97 |
defparam padd_3.BREG=1'b1; |
| 98 |
defparam padd_3.ADD_SUB=1'b0; |
| 99 |
defparam padd_3.BSEL_MODE=1'b1; |
| 100 |
defparam padd_3.SOREG=1'b0; |
| 101 |
defparam padd_3.PADD_RESET_MODE="SYNC"; |
| 102 |
|
| 103 |
PADD9 padd_4( |
| 104 |
.A({9'h123}), |
| 105 |
.B({9'hd}), |
| 106 |
.SI({9{gnd}}), |
| 107 |
.SBI({9{gnd}}), |
| 108 |
.ASEL(gnd), |
| 109 |
.CE(1'b1), |
| 110 |
.CLK(clk), |
| 111 |
.RESET(reset), |
| 112 |
.SO(), |
| 113 |
.SBO(sob2), |
| 114 |
.DOUT(product4[8:0]) |
| 115 |
); |
| 116 |
defparam padd_4.AREG=1'b0; |
| 117 |
defparam padd_4.BREG=1'b1; |
| 118 |
defparam padd_4.ADD_SUB=1'b0; |
| 119 |
defparam padd_4.BSEL_MODE=1'b0; |
| 120 |
defparam padd_4.SOREG=1'b0; |
| 121 |
defparam padd_4.PADD_RESET_MODE="SYNC"; |
| 122 |
endmodule |
| 123 |
|
| 124 |
`define FIRMWARE "riscv-firmware/padd9.hex" |
| 125 |
`include "dsp-riscv.v" |
| 126 |
|