Experiment 2
Experiment 2
arithmetic operations, use case statement and if statement for ALU behavioral modeling. a.
Perform functional verification using test bench b. Synthesize the design targeting suitable
library by setting area and timing constraints c. For various constrains set, tabulate the area,
power and delay for the synthesized netlist d. Identify the critical path and set the
constraints to obtain optimum gate level netlist with suitable constraints Compare the
synthesis results of ALU modeled using IF and CASE statements.
//Design block using case
module ALU_32bit(a,b,opcode,enable,y);
input [31:0] a,b; // declare input [31:0] a,b for 32 bit ALU
always@(a,b,enable,opcode)
begin
if(enable==1'b1)
begin
case (opcode)
4'b0001 :y= a+ b;
4'b0100 :y= a/ b;
4'b1000 :y= a^ b;
endcase
end
else
begin
y=32'd0; //y=32’d0;
end
end
endmodule
module ALU_32bit(a,b,opcode,enable,y);
input [31:0] a,b; // declare input [31:0] a,b for 32 bit ALU
always@(a,b,enable,opcode)
begin
if(enable==1'b1)
begin
//Stimulus block
module testADC;
ALU_32bit AA (.a(a),.b(b),opcode(opcode),.enable(enable),.y(y));
initial
begin
#10 opcode=4’d3;
#10 opcode=4’d5;
#10 opcode=4’d7;
#10 opcode=4’d0;
#10; opcode =4’b1001; // try giving opcode 4’b 0x01, 00z0 etc
end
endmodule