VLSI Lab Report 8
VLSI Lab Report 8
VLSI Lab Report 8
Lab Report : 08
Date Flow Modelling
Submitted to:
Sir Asad Ur Rahman
Submitted by:
M.Bilawal Bhutto (200401016)
Shaheer Arshad (200401014)
Amna Ahmad (200401031)
, 200401014, 200401011
Equipment:
• Nexys4 DDR
• XILINX VIVADO
Introduction:
This lab is based on performing different task in Verilog using Data flow modeling. Assign key
word used for data flow modeling. Here is introduction of lab tasks that are being performed in
this lab.
Design and implement an ALU in Verilog that performs eight different arithmetic and
logical operations on binary data by using Assign key word. In this task we will have 8 operation,
2 4-bit inputs, and 3-bit opcode.
Implement a 4-bit adder using 1-bit adder. In this task we will call 1 bit adder four time
for 4-bit.
• Design and implement a 2x2 multiplier using assign key word. In this task we will have two
input, one output and select of 1 bit.
Implement an 8x1 multiplexer using dataflow modeling and the ?: operator. Understand
the conditional behavior of the ?: operator and its applications in data selection. In this we
have 8 inputs, one output and 4-bit select.
3.3 BCD to 7-Segment Decoder:
Design and implement a decoder circuit that converts Binary-Coded Decimal (BCD)
values to corresponding 7-segment LED displays. In this task we will have 4 inputs , seven
output and one 7-bit output.
Implement a circuit that converts 4-bit binary numbers to their equivalent Gray code
representations. Understand the relationship between binary and Gray codes and their
applications.
Implement program flow control logic using the ?: operator in a single line of Verilog
code. Demonstrate the conciseness and efficiency of the ?: operator in conditional branching.
This lab will provide you with a solid foundation in Verilog dataflow modeling. You with the
necessary skills to design and implement various digital circuits and there Test bench files for
simulation.
All task will be performed using Data flow modeling(assign). XILINX VIVADO software will
be used to perform tasks. Nexys4 DDR FPGA board will be used for implementation. We can
also use zed board. In this we have to create two files one for main design (.v file) and other one
for testing generally as test bench file(simulation file). In test bench we have to specify inputs.
Test bench file is used only for simulation purpose to check weather our design working properly
or not. If design will work properly then we will move to hardware. For hardware we have to
create a user constrain file(UCF) file. In which we have to specify input and output pins of circuit
with hardware pins. Here is the general procedure to perform tasks on XILINX VIVADO
software.
Procedure:
• Open Vivado and click Create Project.
• You will see given window. Click on next:
• In sources click add sources. And select Add or create design sources to create Main.v
file
• Click Next. Add sources window will appear.
#10 $finish;
end
initial
begin
$display("ALU_Design ");
$monitor("time=%0d a=%b b=%b ans=%b
op_code=%b " , $time, a, b, ans, op_code);
end
endmodule
Wave Form:
TCL console:
Schematic:
Lab Task 2: Implement 4-bit Adder by instantiating four 1-bit Full Adder designed in data
flow modelling.
HALF_ADDER a1(a,b,sum0,carry0);
HALF_ADDER a2(cin,sum0, sum,carry1);
assign cout=carry0 + carry1;
endmodule
input a , b;
output sum, carry;
assign sum = a ^ b;
assign carry = a & b;
endmodule
Wave Form:
Source window: here you can see 4 1-bit adder are called:
TCL console:
Schematic:
endmodule end
initial
module HALF_ADDER( a, b, sum, cin ); begin
$display("TWO_BIT_MULTIPLIER");
input a , b; $monitor("time=%0d a=%b b=%b sum=%b
output sum, cin; cout=%b " , $time, a,b, sum, cout);
end
assign sum = a ^ b;
assign cin = a & b;
endmodule
endmodule
Wave Form:
TCL console:
Schematic:
Lab Task 3: Implement following designs using Data Flow modelling.
• 8x1 MUX(Tertiary Operator)
end
initial
begin
$display("MUX_8X1");
$monitor("time=%0d A=%b B=%b C=%b
D=%b E =%b F=%b H=%b select=%b
mux_output=%b " , $time, A, B, C, D, E, F,
H ,select, mux_output);
end
endmodule
Wave Form:
TCL console:
Schematic:
Lab Task 3: Implement following designs using Data Flow modelling.
• BCD to 7-Segment Decoder
endmodule
Wave Form:
TCL console:
Schematic:
Lab Task 3: Implement following designs using Data Flow modelling.
• bit binary to gray converter
#5 binary_input = 4'b0010;
#5 binary_input = 4'b0011;
$finish;
end
initial
begin
$display("4-bit binary to gray converter ");
$monitor("time=%0d binary_input=%b
gray_output=%b " , $time, binary_input,
gray_output);
end
endmodule
Wave Form:
TCL console:
Schematic:
Lab Task 4: . Design code for an assembler to manage program flow of a microprocessor
i.e. handle Program counter PC. Try to code the functionality in one line using ?: operators.PC is
16-bit. OFFSET is 8-bit but in 2’s complement. If reset flag is high, jump PC to 0000. If branch
flag is high, jump PC to PC + OFFSET.
$finish;
end
initial
begin
$display("PROGRAM COUNTER");
$monitor("time=%0d NEXT_PC=%b
OFFSET=%b BRANCH=%b " , $time,
NEXT_PC,OFFSET,BRANCH );
end
endmodule
Wave Form:
Schematic:
Conclusion:
In this lab we had performed multiple task with the help of Verilog (Data Flow modeling)
codding by using XILINX VIVADO software. We had also observed Schematic and simulation
of all tasks. Some of the tasks are mentioned below:
• Successfully Implemented Designed ALU
• Successfully Implemented 4-bit Adder using 1-bit Adder
• Successfully Implemented 2x2 Multiplier
• Successfully Implemented 8x1 MUX(Tertiary Operator)
• Successfully Implemented BCD to 7-Segment Decoder
• Successfully Implemented 4 bit binary to gray converter
• Successfully Implemented program flow control using the ?: operator: