Debian Codegraph @

examples/dsp-mult36x36.v

raw
1 `default_nettype none
2 module idsp(input wire clk, input wire reset,
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 gnd = 1'b0;
10
11 // Simple multiplication of positive numbers without registers
12 MULT36X36 mu_0(
13 .A({36'h412345678}),
14 .B({36'h187654321}),
15 .ASIGN(gnd),
16 .BSIGN(gnd),
17 .CE(1'b1),
18 .CLK(clk),
19 .RESET(reset),
20 .DOUT({product1[7:0], product})
21 );
22 defparam mu_0.AREG=1'b0;
23 defparam mu_0.BREG=1'b0;
24 defparam mu_0.OUT0_REG=1'b0;
25 defparam mu_0.OUT1_REG=1'b0;
26 defparam mu_0.PIPE_REG=1'b0;
27 defparam mu_0.ASIGN_REG=1'b0;
28 defparam mu_0.BSIGN_REG=1'b0;
29 defparam mu_0.MULT_RESET_MODE="SYNC";
30
31 // Multiplication of negative numbers with all registers
32 MULT36X36 mu_1(
33 .A({36'haebdccdbf}), // -0x514233241
34 .B({36'hfffdcba99}), // -0x234567
35 .ASIGN(1'b1),
36 .BSIGN(1'b1),
37 .CE(1'b1),
38 .CLK(clk),
39 .RESET(reset),
40 .DOUT({product3[7:0], product2})
41 );
42 defparam mu_1.AREG=1'b1;
43 defparam mu_1.BREG=1'b1;
44 defparam mu_1.OUT0_REG=1'b1;
45 defparam mu_1.OUT1_REG=1'b1;
46 defparam mu_1.PIPE_REG=1'b1;
47 defparam mu_1.ASIGN_REG=1'b1;
48 defparam mu_1.BSIGN_REG=1'b1;
49 defparam mu_1.MULT_RESET_MODE="SYNC";
50 endmodule
51
52 `define FIRMWARE "riscv-firmware/mult36x36.hex"
53 `include "dsp-riscv.v"
54