DataFlow Modelling
DataFlow Modelling
SCHOOL OF EE-ECE-CpE
Dataflow Modelling
DRILL 6
NAME:
STUDENT NUMBER:
TERMINAL NUMBER:
DATE OF PERFORMANCE:
DATE OF SUBMISSION:
______________________
PROFESSOR
I. DISCUSSION
Dataflow modelling of combinational logic uses a number of
operators that act on operands to produce desired results. It uses
continuous assignments and the keyword assign. If the identifier of a net is
a left-hand side of a continuous assignment statement or a procedural
assignment statement, the value assigned to the net is specified by an
expression that uses operands and operators.
module testMagCom();
reg [3:0] A, B;
wire lt, gt, eq;
magcom tb(A, B, lt, gt, eq);
reg [255:0]string1, string2, string3;
initial fork
2
A=1'b0; B=1'b0;
$display(" A B \t\t\t\t A<B \t\t \t\t A>B\t\t\t\t A==B");
$monitor("%d %d %s %s %s",A, B, string1, string2, string3);
join
initial begin
#1 A=4'd7;
B=4'd7;
if (lt==1) string1="true";
else string1="false";
if (gt==1) string2="true";
else string2="false";
if (eq==1) string3="true";
else string3="false";
#3 A=4'd4;
B=4'd6;
if (lt==1) string1="true";
else string1="false";
if (gt==1) string2="true";
else string2="false";
if (eq==1) string3="true";
else string3="false";
#5 A=4'd9;
B=4'd8;
if (lt==1) string1="true";
else string1="false";
if (gt==1) string2="true";
else string2="false";
if (eq==1) string3="true";
else string3="false";
#7 A=4'd10;
B=4'd1;
if (lt==1) string1="true";
else string1="false";
if (gt==1) string2="true";
3
else string2="false";
if (eq==1) string3="true";
else string3="false";
#9 $finish;
end
endmodule
2. Design an all-bit zero/one detector using dataflow modelling. Save the file
as drill6_2.vl
module AllBitTest();
reg [31:0] inputX;
wire outputZ, outputO;
3. Construct a JK flip-flop from a D flip-flop and gates, and use the circuit to
design the Verilog program. Use behavioural model for the D flip-flop and
dataflow model for the JK flip-flop. Save the file as drill6_3.vl
module TestFlipFlop;
reg J, K, clk, reset;
wire Q;
always #1 clk=~clk;
JK_flipflop JKF(Q,J,K,clk,reset);
initial clk=0;
initial reset=0;
initial J=0;
initial K=0;
initial $monitor("clk=%b reset=%b, J=%b, K=%b,
Q=%b",clk,reset,J,K,Q);
initial fork
#28 $finish;
#2 reset=1;
#4 J=1;
#8 K=1;
#12 J=0;
#16 K=0;
#20 J=1;
5
#24 J=0;
join
endmodule