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
Assume that each of PG Unite, Carry Look ahead (CLA) Unit and Sum unit has a...
Assume that each of PG Unite, Carry Look ahead (CLA) Unit and Sum unit has a delay of2delta, what will be the Delay of: 1- 128-bit adder if for design complexity reasons, the size of each CLA is limited to 4-bits. 2- 256 -bit adder if for design complexity reasons, the size of each CLA is limited to 8-bits. Show one equation that represent each level of dealy, example PG unit, first level CLA ( show C0) etc.
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.
I have an 4-bit unsigned Binary adder that performs F=A+B with carry in and carry out,...
I have an 4-bit unsigned Binary adder that performs F=A+B with carry in and carry out, I have to draw the smallest circuit using the adder and whatever other combinational logic gates I need to perform the 4-bit function below on 2's complement numbers A and B F=A+B if ADD=1, F=A-B if ADD=0
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