Question

Please write verilog code for a 4-bit Carry Look-Ahead (CLA) Adder.

Please write verilog code for a 4-bit Carry Look-Ahead (CLA) Adder.

Homework Answers

Answer #1

Code for 4 bit CLA

module CLA(a,b,ci,co,s);
input [3:0]a,b;
output [4:0]s;
input ci;
output co;
wire [3:0]G,P,C;
assign G = a&b;
assign P = a^b;
assign co=G[3]+ (P[3]&G[2]) + (P[3]&P[2]&G[1]) + (P[3]&P[2]&P[1]&G[0]) + (P[3]&P[2]&P[1]&P[0]&ci);
assign C[3]=G[2] + (P[2]&G[1]) + (P[2]&P[1]&G[0]) + (P[2]&P[1]&P[0]&ci);
assign C[2]=G[1] + (P[1]&G[0]) + (P[1]&P[0]&ci);
assign C[1]=G[0] + (P[0]&ci);
assign C[0]=ci;
assign s = {co,P^C};

endmodule

Code for Test Bench
module fi;
reg [3:0] a;
reg [3:0] b;
reg ci;
wire co;
wire [4:0] s;
CLA uut (
.a(a),
.b(b),
.ci(ci),
.co(co),
.s(s)
);

initial begin
// Initialize Inputs
a = 4'b1101;
b = 4'b1011;
ci = 0;
end
  
endmodule.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Design a verilog code for four-bit subtractor. write the simulation code and constraints file for nexys...
Design a verilog code for four-bit subtractor. write the simulation code and constraints file for nexys 4.
Use contraction beginning with a 4-bit adder-subtractor with carry in, to design a 4-bit circuit without...
Use contraction beginning with a 4-bit adder-subtractor with carry in, to design a 4-bit circuit without carry out that increments its input by 0010 for input S=0 and decrements its input by 0010 for input S=1. Perform the design by designing the distinct 1-bit full adder cells needed and indicating the type of cell used in each of the four bit positions.
Design a Single cell 1 bit Carry propagate (or Ripple Carry Adder) full adder. a. Generate...
Design a Single cell 1 bit Carry propagate (or Ripple Carry Adder) full adder. a. Generate the truth table b. Using K-map or Boolean algebra, determine the logical expression for Carry out (C-out) and Sum (S) Outputs C. Draw the circuit diagram of the outputs in step b
Design a 4 to 16 decoder using Verilog HDL. The inputs are a four-bit vector W=...
Design a 4 to 16 decoder using Verilog HDL. The inputs are a four-bit vector W= [w1 w2 w3 w4] and an enable signal En. The outputs are represented by the 16-bit vector Y= [y0 y1 …..y15]. a) Write Verilog HDL behavioral style code for 2-to-4 decoder. b) Write Verilog HDL behavioral style code for 4-to-16 decoder by instantiation of 2-to-4 decoders.
Design a 4 to 16 decoder using Verilog HDL. The inputs are a four-bit vector W=...
Design a 4 to 16 decoder using Verilog HDL. The inputs are a four-bit vector W= [w1 w2 w3 w4] and an enable signal En. The outputs are represented by the 16-bit vector Y= [y0 y1 …..y15]. a) Write Verilog HDL behavioral style code for 2-to-4 decoder. b) Write Verilog HDL behavioral style code for 4-to-16 decoder by instantiation of 2-to-4 decoders.
Write down the VERILOG code for a 2-to-4 decoder and the testbench code to test it
Write down the VERILOG code for a 2-to-4 decoder and the testbench code to test it
Please show complete Verilog code. Write a Verilog description for 3-to-8 decoder generating low outputs when...
Please show complete Verilog code. Write a Verilog description for 3-to-8 decoder generating low outputs when enabled with a low enable.
Write a HDLcode for an 8 bit shift register with a reset pin. for system verilog...
Write a HDLcode for an 8 bit shift register with a reset pin. for system verilog please
Write down the VERILOG code for an AND gate and the testbench code to test it
Write down the VERILOG code for an AND gate and the testbench code to test it
Adder Start out by picking 2 positive six bit binary numbers that are less than 3210,...
Adder Start out by picking 2 positive six bit binary numbers that are less than 3210, written in 2's complement notation. The eventual goal is to add these two numbers. 1) Look at the LSB bit of the numbers, and using logic gates (NANDs, NORs, etc.) design a circuit that correctly gives the right output for any possible combination of bits in the LSB place. 2) Now look at the next column to the left (next to LSB). In this...