Lab 6
Lab 6
Spring 2021
Lab Report 6
DESIGN AND IMPLEMENTATION USING DATAFLOW
MODELING
Prepared By:
Shahzaib Ahmad Qureshi: F2016019065
Digital System Design LAB 6
Objectives:
On successful completion of this lab, students will be able to:
a. Design and Implement the digital circuits using Dataflow level modeling.
b. Describe the continuous assignment (assign) statement, restrictions on the assign
statement, and the implicit continuous assignment statement.
c. Define expressions, operators, and operands.
d. Use operator types for all possible operations-arithmetic, logical, relational,
equality, bitwise, reduction, shift, concatenation, and conditional.
e. Use Dataflow level modeling constructs to model practical digital circuits in Verilog
Task1:
Take a 4 bit input from user and perform bit wise AND, OR, XOR, XNOR with 4’b1001 and display each
output on LEDs on nexus board.
Verilog Code:
module All_Gates(A,O,XO,XN,X);
input [3:0] X;
assign O = (X | 4'b0101);
assign XO = (X ^ 4'b0101);
assign XN = (X ~^ 4'b0101);
endmodule
Test-bench File:
module All_Gates_tb;
// Inputs
reg [3:0] X;
// Outputs
wire [3:0] A;
wire [3:0] O;
initial begin
// Initialize Inputs
X = 0000; #100;
X = 0001; #100;
X = 0010; #100;
X = 0011; #100;
X = 0100; #100;
X = 0101; #100;
X = 0110; #100;
X = 0111; #100;
X = 1000; #100;
X = 1001; #100;
X = 1010; #100;
X = 1011; #100;
X = 1100; #100;
X = 1101; #100;
X = 1110; #100;
X = 1111; #100;
end
endmodule
Digital System Design LAB 6
OUTPUT:
Design Problem 1:
Design a digital circuit which takes one 1 bit input and two 5 bits inputs from the user and perform
XNOR operation. If one bit input is equal to 1 output the data and shift the data by 3 bits right if one bit
value is 0. Display the output on LEDs on nexus board
Verilog Code:
module Shift_Data(F,A,B,Control);
output [4:0] F;
input Control;
endmodule
Test-bench File:
module Shift_Data_tb;
// Inputs
reg [4:0] A;
reg [4:0] B;
reg Control;
// Outputs
Digital System Design LAB 6
wire [4:0] F;
initial begin
// Initialize Inputs
end
endmodule
OUTPUT: