0% found this document useful (0 votes)
9 views19 pages

Assignment 5

The document outlines an assignment to design an 8x8 Wallace Tree Multiplier in Verilog, both with and without a 3-stage pipeline. It includes objectives, Verilog code for the designs, testbench code, and results such as schematics, timing reports, and power reports. The assignment is part of a Skill Development Course for the academic year 2025-2026.

Uploaded by

Narendiran V.B
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views19 pages

Assignment 5

The document outlines an assignment to design an 8x8 Wallace Tree Multiplier in Verilog, both with and without a 3-stage pipeline. It includes objectives, Verilog code for the designs, testbench code, and results such as schematics, timing reports, and power reports. The assignment is part of a Skill Development Course for the academic year 2025-2026.

Uploaded by

Narendiran V.B
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ASSIGNMENT - 3

8 × 8 Wallace Tree Multiplier with and without Pipeline

Submitted By

Narendiran V B (124EC0017)

[Link]

COURSE: Skill Development Course I(Python) - EC292

Academic Year 2025-2026


1 Objective
• Design a 8 x 8 Wallace Tree Multiplier with and without the 3-stage pipeline in Verilog.

• Simulate both the designs with the separate test benches. In the pipelined design, the
outputs need to be produced at every clock cycle after the 3rd cycle.

• Do the synthesis of both the designs using 45 nm CMOS technology in Cadence Genus.

2 Common Multiplexer Module


The following 8 bit-CLA based 16 bit-Carry Select Adder(CSA) is used in the final stage
addition for both designs(The 8-bit RCA based CLA which is implemented here is from previous
assignment) .
1 ‘include " cla . v "
2 module c ar ry _s el ec t_ ad de r (
3 input [15:0] A ,
4 input [15:0] B ,
5 input cin ,
6 output [15:0] Sum ,
7 output Cout
8 );
9 wire [7:0] sum_lower ;
10 wire c_out_lower ;
11 wire [7:0] sum_upper_0 , sum_upper_1 ;
12 wire c_out_upper_0 , c_out_upper_1 ;
13
14 eight_bit_cla lower (
15 . A ( A [7:0]) ,
16 . B ( B [7:0]) ,
17 . cin ( cin ) ,
18 . sum ( sum_lower ) ,
19 . carry_out ( c_out_lower )
20 );
21
22 eight_bit_cla upper0 (
23 . A ( A [15:8]) ,
24 . B ( B [15:8]) ,
25 . cin (1 ’ b0 ) ,
26 . sum ( sum_upper_0 ) ,
27 . carry_out ( c_out_upper_0 )
28 );
29
30 eight_bit_cla upper1 (
31 . A ( A [15:8]) ,
32 . B ( B [15:8]) ,
33 . cin (1 ’ b1 ) ,
34 . sum ( sum_upper_1 ) ,
35 . carry_out ( c_out_upper_1 )
36 );
37 assign Sum [7:0] = sum_lower ;
38 assign Sum [15:8] = ( c_out_lower ) ? sum_upper_1 : sum_upper_0 ;
39 assign Cout = ( c_out_lower ) ? c_out_upper_1 : c_out_upper_0 ;
40 endmodule

Listing 1: carry select adder.v

1
3 Design 1: Without Pipeline
3.1 Verilog Code
1 ‘include " c ar ry _se le ct _a dd er . v "
2 module CSA (
3 input [15:0] in1 ,
4 input [15:0] in2 ,
5 input [15:0] in3 ,
6 output [15:0] sum ,
7 output [15:0] carry
8 );
9 assign sum = in1 ^ in2 ^ in3 ;
10 assign carry = (( in1 & in2 ) | ( in2 & in3 ) | ( in1 & in3 ) ) << 1;
11 endmodule
12
13
14
15 module wa l l an c e _t r e e _8 _ b it (
16 input [7:0] a , input [7:0] b , output [15:0] product
17 );
18 wire [15:0] pp0 , pp1 , pp2 , pp3 , pp4 , pp5 , pp6 , pp7 ;
19 wire [15:0] sum1 , carry1 ;
20 wire [15:0] sum2 , carry2 ;
21
22 assign pp0 = (a & {8{ b [0]}}) << 0;
23 assign pp1 = (a & {8{ b [1]}}) << 1;
24 assign pp2 = (a & {8{ b [2]}}) << 2;
25 assign pp3 = (a & {8{ b [3]}}) << 3;
26 assign pp4 = (a & {8{ b [4]}}) << 4;
27 assign pp5 = (a & {8{ b [5]}}) << 5;
28 assign pp6 = (a & {8{ b [6]}}) << 6;
29 assign pp7 = (a & {8{ b [7]}}) << 7;
30
31 CSA csa1 (. in1 ( pp0 ) , . in2 ( pp1 ) , . in3 ( pp2 ) , . sum ( sum1 ) , . carry ( carry1 ) ) ;
32
33 CSA csa2 (. in1 ( pp3 ) , . in2 ( pp4 ) , . in3 ( pp5 ) , . sum ( sum2 ) , . carry ( carry2 ) ) ;
34
35 wire [15:0] sum3 , carry3 ;
36 CSA csa3 (. in1 ( sum1 ) , . in2 ( carry1 ) , . in3 ( sum2 ) , . sum ( sum3 ) , . carry ( carry3 ) ) ;
37
38 wire [15:0] sum4 , carry4 ;
39 CSA csa4 (. in1 ( carry2 ) , . in2 ( pp6 ) , . in3 ( pp7 ) , . sum ( sum4 ) , . carry ( carry4 ) ) ;
40

41 wire [15:0] sum5 , carry5 ;


42 CSA csa5 (. in1 ( sum3 ) , . in2 ( carry3 ) , . in3 ( sum4 ) , . sum ( sum5 ) , . carry ( carry5 ) ) ;
43
44 wire [15:0] sum6 , carry6 ;
45 CSA csa6 (. in1 ( sum5 ) , . in2 ( carry5 ) , . in3 ( carry4 ) , . sum ( sum6 ) , . carry ( carry6 )
);
46
47 ca rr y_ se le ct _a dd er final_adder (
48 . A ( sum6 ) ,
49 . B ( carry6 ) ,
50 . cin (1 ’ b0 ) ,
51 . Sum ( product ) ,
52 . Cout ()
53 );
54
55

2
56 endmodule

Listing 2: wallance tree 8 bit.v

3.2 Testbench Code


1

2 ‘include " wallance_tree . v "


3 module wallace_tree_tb ;
4 reg [7:0] A ;
5 reg [7:0] B ;
6 wire [15:0] Product ;
7 wire [15:0] Expected ;
8 w al l a nc e _ tr e e _8 _ b it uut (
9 .a(A),
10 .b(B),
11 . product ( Product )
12 );
13

14 assign Expected = A * B ;
15
16 integer i ;
17 integer errors = 0;
18
19 initial begin
20 $dumpfile ( " wallace_tree . vcd " ) ;
21 $dumpvars (0 , wallace_tree_tb ) ;
22
23 $display ( " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " ) ;
24 $display ( " Starting Wallace Tree Multiplier Test ... " ) ;
25

26
27
28 A = 0; B = 0; #10; check () ;
29
30 A = 255; B = 255; #10; check () ;
31

32 A = 1; B = 255; #10; check () ;


33
34 A = 255; B = 1; #10; check () ;
35
36 A = 128; B = 128; #10; check () ;
37

38
39 for ( i = 0; i < 100; i = i + 1) begin
40 A = $random ;
41 B = $random ;
42 #10;
43 check () ;
44 $display ( " A = %d , B = %d , Product = % d " , A , B , Product ) ;
45 end
46
47
48 $display ( " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " ) ;
49 if ( errors == 0) begin
50 $display ( " SUCCESS : All tests passed ! (105 vectors checked ) " ) ;
51 end else begin
52 $display ( " FAILURE : Found %0 d mismatches . " , errors ) ;
53 end

3
54 $display ( " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " ) ;
55 $finish ;
56 end
57
58 endmodule

Listing 3: tb wallance tree 8 bit.v

3.3 Results
3.3.1 Schematic

./assigment3/without/[Link]

Figure 1: Schematic (Without Pipeline)

4
3.3.2 Timing Report

./assigment3/without/Timing_Report.png

Figure 2: Timing Report (Without Pipeline)

5
3.3.3 Power Report

./assigment3/without/Power_Report.png

Figure 3: Power Report (Without Pipeline)

6
3.3.4 Area and Cell Count

./assigment3/without/Gate_Count.png

Figure 4: Area and Cell Report (Without Pipeline)

7
3.3.5 Waveform

./assigment3/without/[Link]

Figure 5: Output (Without Pipeline)

8
3.3.6 Waveform

./assigment3/without/[Link]

Figure 6: Waveform (Without Pipeline)

9
4 Design 2: With Pipeline
4.1 Verilog Code
1 ‘include " c ar ry _se le ct _a dd er . v "
2 module CSA (
3 input [15:0] in1 ,
4 input [15:0] in2 ,
5 input [15:0] in3 ,
6 output [15:0] sum ,
7 output [15:0] carry
8 );
9 assign sum = in1 ^ in2 ^ in3 ;
10 assign carry = (( in1 & in2 ) | ( in2 & in3 ) | ( in1 & in3 ) ) << 1;
11 endmodule
12
13
14 module w a l l a n c e _ t r e e _ 8 _ b i t _ p i p e (
15 input clk ,
16 input rst ,
17 input [7:0] a ,
18 input [7:0] b ,
19 output reg [15:0] product
20 );
21
22 wire [15:0] pp0 , pp1 , pp2 , pp3 , pp4 , pp5 , pp6 , pp7 ;
23 wire [15:0] sum1 , carry1 ;
24 wire [15:0] sum2 , carry2 ;
25 wire [15:0] sum3 , carry3 ;
26
27 assign pp0 = (a & {8{ b [0]}}) << 0;
28 assign pp1 = (a & {8{ b [1]}}) << 1;
29 assign pp2 = (a & {8{ b [2]}}) << 2;
30 assign pp3 = (a & {8{ b [3]}}) << 3;
31 assign pp4 = (a & {8{ b [4]}}) << 4;
32 assign pp5 = (a & {8{ b [5]}}) << 5;
33 assign pp6 = (a & {8{ b [6]}}) << 6;
34 assign pp7 = (a & {8{ b [7]}}) << 7;
35

36
37 CSA csa1 (. in1 ( pp0 ) , . in2 ( pp1 ) , . in3 ( pp2 ) , . sum ( sum1 ) , . carry ( carry1 ) ) ;
38
39 CSA csa2 (. in1 ( pp3 ) , . in2 ( pp4 ) , . in3 ( pp5 ) , . sum ( sum2 ) , . carry ( carry2 ) ) ;
40

41 CSA csa3 (. in1 ( sum1 ) , . in2 ( carry1 ) , . in3 ( sum2 ) , . sum ( sum3 ) , . carry ( carry3 ) ) ;
42
43 reg [15:0] carry2_reg ;
44 reg [15:0] sum3_reg , carry3_reg ;
45 reg [15:0] pp6_reg , pp7_reg ;
46

47
48 always @ ( posedge clk or posedge rst ) begin
49
50 if ( rst ) begin
51 sum3_reg <= 16 ’ b0 ;
52 carry3_reg <= 16 ’ b0 ;
53 pp6_reg <= 16 ’ b0 ;
54 pp7_reg <= 16 ’ b0 ;
55 carry2_reg <= 16 ’ b0 ;
56 end else begin

10
57 sum3_reg <= sum3 ;
58 carry3_reg <= carry3 ;
59 carry2_reg <= carry2 ;
60 pp6_reg <= pp6 ;
61 pp7_reg <= pp7 ;
62 end
63
64

65 end
66
67 wire [15:0] sum4 , carry4 ;
68 wire [15:0] sum5 , carry5 ;
69 wire [15:0] sum6 , carry6 ;
70 reg [15:0] sum6_reg , carry6_reg ;
71 CSA csa4 (. in1 ( carry2_reg ) , . in2 ( pp6_reg ) , . in3 ( pp7_reg ) , . sum ( sum4 ) , . carry
( carry4 ) ) ;
72
73 CSA csa5 (. in1 ( sum3_reg ) , . in2 ( carry3_reg ) , . in3 ( sum4 ) , . sum ( sum5 ) , . carry (
carry5 ) ) ;
74
75 CSA csa6 (. in1 ( sum5 ) , . in2 ( carry5 ) , . in3 ( carry4 ) , . sum ( sum6 ) , . carry ( carry6 )
);
76
77
78 always @ ( posedge clk or posedge rst ) begin
79
80 if ( rst ) begin
81 sum6_reg <= 16 ’ b0 ;
82 carry6_reg <= 16 ’ b0 ;
83 end else begin
84 sum6_reg <= sum6 ;
85 carry6_reg <= carry6 ;
86 end
87 end
88
89 wire [15:0] result ;
90

91 ca rr y_ se le ct _a dd er final_adder (
92 . A ( sum6_reg ) ,
93 . B ( carry6_reg ) ,
94 . cin (1 ’ b0 ) ,
95 . Sum ( result ) ,
96 . Cout ()
97 );
98
99 always @ ( posedge clk or posedge rst ) begin
100 if ( rst ) begin
101
102 product <= 16 ’ b0 ;
103
104 end else begin
105 product <= result ;
106 end
107 end
108

109
110
111 endmodule

Listing 4: wallance tree pipe.v

11
4.2 Testbench Code
1 ‘include " w al la nce _t re e_ pi pe . v "
2 ‘timescale 1 ns /1 ps
3

4 module t b _ w a l l a n c e _ t r e e _ p i p e ;
5
6 reg clk ;
7 reg rst ;
8 reg [7:0] A ;
9 reg [7:0] B ;
10 wire [15:0] product ;
11
12 w a l l a n c e _ t r e e _ 8 _ b i t _ p i p e dut (
13 . clk ( clk ) ,
14 . rst ( rst ) ,
15 .a(A),
16 .b(B),
17 . product ( product )
18 );
19 always #5 clk = ~ clk ;
20
21

22 initial begin
23
24 clk = 0;
25 rst = 1;
26 A = 0;
27 B = 0;
28
29 #10;
30 rst = 0;
31
32 @ ( negedge clk ) ;
33 A = 8 ’ d255 ;
34 B = 8 ’ d255 ;
35
36 @ ( negedge clk ) ;
37 A = 8 ’ d225 ;
38 B = 8 ’ d225 ;
39

40 @ ( negedge clk ) ;
41 A = 8 ’ d255 ;
42 B = 8 ’ d69 ;
43
44 @ ( negedge clk ) ;
45 A = 8 ’ d128 ;
46 B = 8 ’ d128 ;
47
48 @ ( negedge clk ) ;
49 A = 8 ’ d100 ;
50 B = 8 ’ d100 ;
51

52
53 repeat (10) @ ( posedge clk ) ;
54
55 $finish ;
56 end
57

58 initial begin

12
59
60 $dumpfile ( " t b _ w a l l a n c e _ t r e e _ p i p e . vcd " ) ;
61 $dumpvars (0 , t b _ w a l l a n c e _ t r e e _ p i p e ) ;
62 $monitor ( " time " , $time , " PRODUCT =% d " ,
63 product ) ;
64 end
65
66 endmodule

Listing 5: tb wallance tree pipe.v

4.3 Results
4.3.1 Schematic

./assigment3/with/[Link]

Figure 7: Schematic (with Pipeline)

13
4.3.2 Timing Report

./assigment3/with/Timing_Report.png

Figure 8: Timing Report (with Pipeline)

14
4.3.3 Power Report

./assigment3/with/Power_Report.png

Figure 9: Power Report (With Pipeline)

15
4.3.4 Area and Cell Count

./assigment3/with/Gate_Count.png

Figure 10: Area and Cell Report (With Pipeline)

16
4.3.5 Output

./assigment3/with/[Link]

Figure 11: Output (With Pipeline)

17
4.3.6 Waveform

./assigment3/with/[Link]

Figure 12: Waveform (With Pipeline)

4.4 Observation
The performance comparison between non-pipelined and pipelined designs is summarized below:

• The non-pipelined Wallace Tree Multiplier occupies less area and consumes less power
due to the absence of pipeline registers.

• Pipelining introduces additional area and power overhead but significantly improves over-
all performance.

18

Common questions

Powered by AI

Separate test benches for the pipelined and non-pipelined Wallace Tree Multiplier designs allow for the independent verification and benchmarking of each design's performance and correctness. They help ensure that both designs produce the correct product output for a variety of input conditions. The test benches can simulate different scenarios, including edge cases and random inputs, to evaluate the timing, accuracy, and computational efficiency of both designs under controlled conditions. This separation allows for a clear comparison of the advantages and drawbacks of pipeline introduction in terms of throughput, power, and area metrics .

The test bench for the Wallace Tree Multiplier employs several strategies to validate its performance. It includes a variety of test cases with edge values such as all zeros, maximum values, and intermediate patterns to assess how the multiplier handles different input ranges. Randomized testing is done using loops to evaluate typical operation scenarios over numerous cycles. The output from the multiplier is compared to expected values calculated using basic arithmetic to ensure correctness. Monitoring and logging features such as $monitor and $dumpvars are used to track simulation progress and capture waveform data for detailed analysis .

A Carry Select Adder (CSA) enhances the efficiency of an 8x8 Wallace Tree Multiplier by reducing the overall delay in addition operations required at various stages of the multiplier design. The CSA divides the adder into smaller sections and uses a pre-computed carry for both carry-in possibilities (0 and 1) to speed up the addition process significantly. This contributes to a faster addition in the final stage of the product computation, which is crucial for the high-speed operation of multipliers like the Wallace tree .

Pipeline registers play a crucial role in enhancing performance in computer architectures by allowing for overlapping of different operation stages, which increases instruction throughput. In the context of the Wallace Tree Multiplier, these registers enable the intermediate results to be stored between sequential clock cycles, which facilitates higher frequency operations. By dividing the multiplication process into smaller stages and holding these intermediate values, pipeline registers minimize the latency impact of long combinational paths, thereby increasing the overall computation speed and efficiency of the multiplier .

The use of a common multiplexer module in the addition stage of the Wallace Tree Multiplier is significant because it facilitates efficient management of carry propagation delays. It allows for faster decision-making in selecting among multiple potential carry outputs and thus enhances the speed of addition processes critical to the final product generation stage. The multiplexer streamlines the process by compactly organizing and utilizing possible outcomes from the carry-select adder, leading to improved overall performance of the multiplier .

The use of 45 nm CMOS technology for the synthesis of the Wallace Tree Multiplier allows for a higher density of transistors, enabling more complex designs to be implemented in a smaller area. This technology can lead to lower power consumption and higher speed of operation due to reduced parasitic capacitances. However, the challenges include managing power dissipation and ensuring reliability at such small scales. These advantages and considerations make the 45 nm process suitable for high-performance digital applications like the Wallace Tree Multiplier .

The non-pipelined Wallace Tree Multiplier design consumes less area and power compared to the pipelined version. This is primarily due to the absence of pipeline registers in the non-pipelined setup, which reduces overhead. In contrast, the pipelined design introduces additional circuitry to maintain intermediate results between clock cycles, increasing both area and power usage. The trade-off, however, is that the pipelined design significantly improves performance throughput by producing outputs every clock cycle after the initial delay .

The main advantages of implementing an 8x8 Wallace Tree Multiplier with a pipeline are related to performance improvements. The pipelined design significantly increases the throughput by allowing outputs to be produced at every clock cycle after the initial latency of three cycles . However, the pipelined design introduces additional area and power overhead due to the need for pipeline registers, which is a trade-off against the performance benefits .

Feedback from the synthesized designs’ timing and power reports can significantly influence the iteration process in a pipeline-based multiplier project by identifying bottlenecks and inefficiencies in the current design. Timing reports provide insights into critical paths that limit performance, allowing designers to focus optimization efforts on reducing these delays. Power reports highlight areas where power consumption could be minimized, which is essential for creating energy-efficient designs. This data-driven feedback loop enables continual improvement and refinement of the multiplier to meet specific performance, area, and power targets, allowing for a balanced optimization approach .

Employing a testbench with randomized input checks provides several benefits for the Wallace Tree Multiplier project. Randomized testing ensures that the design is evaluated across a wide range of conditions, which increases the likelihood of identifying edge cases and potential issues not considered in static or deterministic tests. It helps uncover undetected bugs and ensures robustness in real-world scenarios. However, the drawback is that randomness can make it difficult to reproduce specific failure scenarios, complicating debugging. It may also be less efficient in covering specific targeted test cases unless carefully directed .

You might also like