0% found this document useful (0 votes)
40 views

Modelsim Simulation Binary Arithmetic Operation

This document describes the design and simulation of a 4-bit binary arithmetic logic unit (ALU) that can perform addition, subtraction, AND, and OR operations. It includes block diagrams, truth tables, logic diagrams, waveform outputs of the logic and arithmetic units in Modelsim, schematics generated in Leonardo Spectrum, the critical path generated in Leonardo Spectrum, and a layout generated in Mentor Graphics. Verilog code for the ALU module and a test bench are also provided to simulate the ALU.

Uploaded by

Hamza Baig
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Modelsim Simulation Binary Arithmetic Operation

This document describes the design and simulation of a 4-bit binary arithmetic logic unit (ALU) that can perform addition, subtraction, AND, and OR operations. It includes block diagrams, truth tables, logic diagrams, waveform outputs of the logic and arithmetic units in Modelsim, schematics generated in Leonardo Spectrum, the critical path generated in Leonardo Spectrum, and a layout generated in Mentor Graphics. Verilog code for the ALU module and a test bench are also provided to simulate the ALU.

Uploaded by

Hamza Baig
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Chip that can complete four-bit binary addition, subtraction, and, or operation

Simulation on Modelsim
Block Diagram of four-bit binary ALU:
Truth Table for 4-Bit Binary ALU:
Logic Diagram of Proposed 4-Bit Binary ALU:
RESULT OF LOGIC UNIT OF Binary and ALU OUTPUT WAVEFORM OF LOGIC UNIT

In this given waveform we can see the simulation result of logic unit simulated using Modelsim 6.2. Input
signals are applied at the input ports and at out port we can see the result.
RESULT OF ARITHMETIC UNIT OF Binary and ALU OUTPUT WAVEFORM OF ARITHMETIC UNIT
OF ALU:

In this given waveform we can see the simulation result of arithmetic unit simulated using Modelsim
6.2. Input signals are applied at the input ports and at out port we can see the result.
IMPLEMENTATION OF BINARY AND SCHEMATIC OF ALU:
The schematic for Binary and ALU generated by LEONARDO SPECTRUM is:
IMPLEMENTATION OF CRITICAL PATH FOR Binary and ALU:

The CRITICAL PATH for Binary and ALU generated by LEONARDO SPECTRUM is shown

IMPLEMENTATION OF LAYOUT OF Binary and ALU:

The layout for ALU generated by MENTOR GRAPHICS (ICStation) is shown


Complete Programming
// source code

module

ALU_program(clk,a,b,op,alu_out);

input clk; input


[3:0] a,b; input
[1:0] op; output
reg [3:0] alu_out;
always @(*)
begin case(op)
2'b00: alu_out=
a&b;
2'b01: alu_out= a|b;
2'b10: alu_out= a+b;
2'b11:
alu_out= a-
b; default:
alu_out=0;
endcase end
endmodule

// test bench

module

alu_test();

// Inputs

reg
clk;
reg
[3:0]
a;
reg [3:0] b;
reg [1:0] op;

// Outputs
wire [3:0] alu_out;

ALU_program a1(clk,a,b,op,alu_out);

initial begin
// Initialize
Inputs

clk=1'b0;
op = 2'b00; a=4'b0001;b=4'b0011;
#20; op = 2'b01;
a=4'b0001;b=4'b0011;
#20;
op = 2'b10; a=4'b0001;b=4'b0011;
#20; op = 2'b11;
a=4'b0001;b=4'b0011;
# 20;

end

always #10 clk=~clk;


endmodule

You might also like