aboutsummaryrefslogtreecommitdiffstats
path: root/examples/gowin/testbench.v
blob: 6d206381e4937424e3ca0119a682c1531f8929ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module testbench;
	reg clk;

	initial begin
		#5 clk = 0;
		forever #5 clk = ~clk;
	end

	wire [15:0] leds;

	initial begin
		// $dumpfile("testbench.vcd");
		// $dumpvars(0, testbench);
		$monitor("%b", leds);
	end

	demo uut (
		.clk  (clk  ),
`ifdef POST_IMPL
		.\leds[0]  (leds[0]),
		.\leds[1]  (leds[1]),
		.\leds[2]  (leds[2]),
		.\leds[3]  (leds[3]),
		.\leds[4]  (leds[4]),
		.\leds[5]  (leds[5]),
		.\leds[6]  (leds[6]),
		.\leds[7]  (leds[7]),
		.\leds[8]  (leds[8]),
		.\leds[9]  (leds[9]),
		.\leds[10] (leds[10]),
		.\leds[11] (leds[11]),
		.\leds[12] (leds[12]),
		.\leds[13] (leds[13]),
		.\leds[14] (leds[14]),
		.\leds[15] (leds[15])
`else
		.leds(leds)
`endif
	);
endmodule
4; wire [Y_WIDTH-1:0] A_buf, B_buf; \$pos #(.A_SIGNED(A_SIGNED), .A_WIDTH(A_WIDTH), .Y_WIDTH(Y_WIDTH)) A_conv (.A(A), .Y(A_buf)); \$pos #(.A_SIGNED(B_SIGNED), .A_WIDTH(B_WIDTH), .Y_WIDTH(Y_WIDTH)) B_conv (.A(B), .Y(B_buf)); wire [Y_WIDTH-1:0] AA = A_buf; wire [Y_WIDTH-1:0] BB = BI ? ~B_buf : B_buf; //wire [Y_WIDTH:0] C = {CO, CI}; wire [Y_WIDTH+1:0] COx; wire [Y_WIDTH+1:0] C = {COx, CI}; /* Start implementation */ (* keep *) fiftyfivenm_lcell_comb #(.lut_mask(16'b0000_0000_1010_1010), .sum_lutc_input("cin")) carry_start (.cout(COx[0]), .dataa(C[0]), .datab(1'b1), .datac(1'b1), .datad(1'b1)); genvar i; generate for (i = 0; i < Y_WIDTH; i = i + 1) begin: slice if(i==Y_WIDTH-1) begin (* keep *) fiftyfivenm_lcell_comb #(.lut_mask(16'b1111_0000_1110_0000), .sum_lutc_input("cin")) carry_end (.combout(COx[Y_WIDTH]), .dataa(1'b1), .datab(1'b1), .datac(1'b1), .datad(1'b1), .cin(C[Y_WIDTH])); assign CO = COx[Y_WIDTH]; end else fiftyfivenm_lcell_comb #(.lut_mask(16'b1001_0110_1110_1000), .sum_lutc_input("cin")) arith_cell (.combout(Y[i]), .cout(COx[i+1]), .dataa(AA[i]), .datab(BB[i]), .datac(1'b1), .datad(1'b1), .cin(C[i+1])); end: slice endgenerate /* End implementation */ assign X = AA ^ BB; endmodule