-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement the DSP primitive. For chips that have these capabilities, a DSP implementation has been added in the form of all the primitives described in the Gowin documentation (UG287-1.3.3E_Gowin Digital Signal Processing (DSP) User Guide), namely: - PADD9 - PADD18 - MULT9X9 - MULT18X18 - MULT36X36 - MULTALU18X18 - MULTALU36X18 - MULTADDALU18X18 - ALU54D The most complex but also the most useful is the MULTADDALU18X18 primitive - it allows you to easily make a typical FIR filter, while all connections between these primitives in the chain will be implemented by direct fixed wires with minimal delay. MULT36X36 are not combined into chains, but they have a different task - this primitive can be found in Linux SOCs. Added examples (in the examples/himbaechel directory) that are based on the tiny Riscv demonstrating UART calculations. Only the TXD pin is used (can be found in the specific .CST file for each board), so on the large computer side, only GND and RXD are enough. Port speed 115200, no parity, 8 data bits, 1 stop bit, linefeed only. Picocom launch example: ``` shell picocom -l --imap lfcrlf -b 115200 /dev/ttyU0 ``` The source code for the riscv test programs is provided along with the assembly instructions, but they are not built during the compilation of the examples due to additional compilers. Implemented the combination of primitives into chains using wires CASO-CASI, SO(A, B)-SI(A, B), as well as SBO-SBI for PADD. Signed-off-by: YRabbit <[email protected]> * I forgot to remove the debugging part. Fixed. Signed-off-by: YRabbit <[email protected]> --------- Signed-off-by: YRabbit <[email protected]>
- Loading branch information
Showing
37 changed files
with
8,885 additions
and
72 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
`default_nettype none | ||
// alu0 mode 0 - simple substraction with accumulator in C | ||
// alu1 mode 1 - addition with CASI and accumulator in A | ||
// alu2 mode 2 - addition with CASI | ||
module idsp(input wire clk, input wire reset, | ||
output wire [63:0] product, | ||
output wire [63:0] product1, | ||
output wire [63:0] product2, | ||
output wire [63:0] product3, | ||
output wire [63:0] product4 | ||
); | ||
|
||
wire [17:0] soa; | ||
wire [17:0] sob; | ||
wire [17:0] soa0; | ||
wire [17:0] sob0; | ||
wire [17:0] soa1; | ||
wire [17:0] sob1; | ||
wire [17:0] soa2; | ||
wire [17:0] sob2; | ||
wire gnd = 1'b0; | ||
|
||
wire [54:0]caso; | ||
wire [54:0]caso0; | ||
|
||
ALU54D alu0( | ||
.A(54'hde1ec7ab1e), | ||
.B(54'hcad), | ||
.DOUT(product[53:0]), | ||
.CASI(gnd), | ||
.CASO(caso), | ||
.ASIGN(gnd), | ||
.BSIGN(gnd), | ||
.ACCLOAD(1'b1), | ||
.CLK(clk), | ||
.CE(1'b1), | ||
.RESET(reset) | ||
); | ||
defparam alu0.AREG=1'b0; | ||
defparam alu0.BREG=1'b0; | ||
defparam alu0.ASIGN_REG=1'b0; | ||
defparam alu0.BSIGN_REG=1'b0; | ||
defparam alu0.ACCLOAD_REG=1'b0; | ||
defparam alu0.OUT_REG=1'b1; | ||
defparam alu0.B_ADD_SUB=1'b1; | ||
defparam alu0.C_ADD_SUB=1'b0; | ||
defparam alu0.ALUD_MODE=2'b0; | ||
defparam alu0.ALU_RESET_MODE="SYNC"; | ||
|
||
ALU54D alu1( | ||
.A(54'h1111), | ||
.B(54'h2), | ||
.DOUT(product1[53:0]), | ||
.CASI(caso), | ||
.CASO(caso0), | ||
.ASIGN(gnd), | ||
.BSIGN(gnd), | ||
.ACCLOAD(gnd), | ||
.CLK(clk), | ||
.CE(1'b1), | ||
.RESET(reset) | ||
); | ||
defparam alu1.AREG=1'b1; | ||
defparam alu1.BREG=1'b0; | ||
defparam alu1.ASIGN_REG=1'b0; | ||
defparam alu1.BSIGN_REG=1'b0; | ||
defparam alu1.ACCLOAD_REG=1'b0; | ||
defparam alu1.OUT_REG=1'b0; | ||
defparam alu1.B_ADD_SUB=1'b0; | ||
defparam alu1.C_ADD_SUB=1'b0; | ||
defparam alu1.ALUD_MODE=1; | ||
defparam alu1.ALU_RESET_MODE="SYNC"; | ||
|
||
ALU54D alu2( | ||
.A(54'h100000000), | ||
.B(54'h00000f000), | ||
.DOUT(product2[53:0]), | ||
.CASI(caso0), | ||
.CASO(), | ||
.ASIGN(gnd), | ||
.BSIGN(gnd), | ||
.ACCLOAD(gnd), | ||
.CLK(clk), | ||
.CE(1'b1), | ||
.RESET(reset) | ||
); | ||
defparam alu2.AREG=1'b1; | ||
defparam alu2.BREG=1'b1; | ||
defparam alu2.ASIGN_REG=1'b1; | ||
defparam alu2.BSIGN_REG=1'b1; | ||
defparam alu2.ACCLOAD_REG=1'b1; | ||
defparam alu2.OUT_REG=1'b0; | ||
defparam alu2.B_ADD_SUB=1'b0; | ||
defparam alu2.C_ADD_SUB=1'b0; | ||
defparam alu2.ALUD_MODE=2; | ||
defparam alu2.ALU_RESET_MODE="SYNC"; | ||
endmodule | ||
|
||
`define FIRMWARE "riscv-dsp-firmware/alu54d.hex" | ||
`include "dsp-riscv.v" | ||
|
Oops, something went wrong.