| 1 |
`default_nettype none |
| 2 |
// alu0 mode 0 - simple substraction with accumulator in C |
| 3 |
// alu1 mode 1 - addition with CASI and accumulator in A |
| 4 |
// alu2 mode 2 - addition with CASI |
| 5 |
module idsp(input wire clk, input wire reset, |
| 6 |
output wire [63:0] product, |
| 7 |
output wire [63:0] product1, |
| 8 |
output wire [63:0] product2, |
| 9 |
output wire [63:0] product3, |
| 10 |
output wire [63:0] product4 |
| 11 |
); |
| 12 |
|
| 13 |
wire [17:0] soa; |
| 14 |
wire [17:0] sob; |
| 15 |
wire [17:0] soa0; |
| 16 |
wire [17:0] sob0; |
| 17 |
wire [17:0] soa1; |
| 18 |
wire [17:0] sob1; |
| 19 |
wire [17:0] soa2; |
| 20 |
wire [17:0] sob2; |
| 21 |
wire gnd = 1'b0; |
| 22 |
|
| 23 |
wire [54:0]caso; |
| 24 |
wire [54:0]caso0; |
| 25 |
|
| 26 |
ALU54D alu0( |
| 27 |
.A(54'hde1ec7ab1e), |
| 28 |
.B(54'hcad), |
| 29 |
.DOUT(product[53:0]), |
| 30 |
.CASI(gnd), |
| 31 |
.CASO(caso), |
| 32 |
.ASIGN(gnd), |
| 33 |
.BSIGN(gnd), |
| 34 |
.ACCLOAD(1'b1), |
| 35 |
.CLK(clk), |
| 36 |
.CE(1'b1), |
| 37 |
.RESET(reset) |
| 38 |
); |
| 39 |
defparam alu0.AREG=1'b0; |
| 40 |
defparam alu0.BREG=1'b0; |
| 41 |
defparam alu0.ASIGN_REG=1'b0; |
| 42 |
defparam alu0.BSIGN_REG=1'b0; |
| 43 |
defparam alu0.ACCLOAD_REG=1'b0; |
| 44 |
defparam alu0.OUT_REG=1'b1; |
| 45 |
defparam alu0.B_ADD_SUB=1'b1; |
| 46 |
defparam alu0.C_ADD_SUB=1'b0; |
| 47 |
defparam alu0.ALUD_MODE=2'b0; |
| 48 |
defparam alu0.ALU_RESET_MODE="SYNC"; |
| 49 |
|
| 50 |
ALU54D alu1( |
| 51 |
.A(54'h1111), |
| 52 |
.B(54'h2), |
| 53 |
.DOUT(product1[53:0]), |
| 54 |
.CASI(caso), |
| 55 |
.CASO(caso0), |
| 56 |
.ASIGN(gnd), |
| 57 |
.BSIGN(gnd), |
| 58 |
.ACCLOAD(gnd), |
| 59 |
.CLK(clk), |
| 60 |
.CE(1'b1), |
| 61 |
.RESET(reset) |
| 62 |
); |
| 63 |
defparam alu1.AREG=1'b1; |
| 64 |
defparam alu1.BREG=1'b0; |
| 65 |
defparam alu1.ASIGN_REG=1'b0; |
| 66 |
defparam alu1.BSIGN_REG=1'b0; |
| 67 |
defparam alu1.ACCLOAD_REG=1'b0; |
| 68 |
defparam alu1.OUT_REG=1'b0; |
| 69 |
defparam alu1.B_ADD_SUB=1'b0; |
| 70 |
defparam alu1.C_ADD_SUB=1'b0; |
| 71 |
defparam alu1.ALUD_MODE=1; |
| 72 |
defparam alu1.ALU_RESET_MODE="SYNC"; |
| 73 |
|
| 74 |
ALU54D alu2( |
| 75 |
.A(54'h100000000), |
| 76 |
.B(54'h00000f000), |
| 77 |
.DOUT(product2[53:0]), |
| 78 |
.CASI(caso0), |
| 79 |
.CASO(), |
| 80 |
.ASIGN(gnd), |
| 81 |
.BSIGN(gnd), |
| 82 |
.ACCLOAD(gnd), |
| 83 |
.CLK(clk), |
| 84 |
.CE(1'b1), |
| 85 |
.RESET(reset) |
| 86 |
); |
| 87 |
defparam alu2.AREG=1'b1; |
| 88 |
defparam alu2.BREG=1'b1; |
| 89 |
defparam alu2.ASIGN_REG=1'b1; |
| 90 |
defparam alu2.BSIGN_REG=1'b1; |
| 91 |
defparam alu2.ACCLOAD_REG=1'b1; |
| 92 |
defparam alu2.OUT_REG=1'b0; |
| 93 |
defparam alu2.B_ADD_SUB=1'b0; |
| 94 |
defparam alu2.C_ADD_SUB=1'b0; |
| 95 |
defparam alu2.ALUD_MODE=2; |
| 96 |
defparam alu2.ALU_RESET_MODE="SYNC"; |
| 97 |
endmodule |
| 98 |
|
| 99 |
`define FIRMWARE "riscv-firmware/alu54d.hex" |
| 100 |
`include "dsp-riscv.v" |
| 101 |
|