Module 3 - Data Flow Modelling
Module 3 - Data Flow Modelling
Table of Contents
Introduction ............................................................................................................................................... 1
Learning Outcome ................................................................................................................................... 1
Learning Content...................................................................................................................................... 1
Data Flow Modelling ............................................................................................................................. 2
A. Continuous Assignments .......................................................................................................... 2
Implicit Continuous Assignment.................................................................................................... 2
B. Delays ......................................................................................................................................... 3
Regular Assignment Delay ............................................................................................................ 3
Implicit Continuous Assignment Delay ........................................................................................ 4
Net Declaration Delay................................................................................................................... 5
C. Expressions, Operators, and Operands .................................................................................. 6
Expressions ...................................................................................................................................... 6
Operands ........................................................................................................................................ 7
Operators ........................................................................................................................................ 7
D. Example ..................................................................................................................................... 8
Dataflow 4-to-1 Multiplexer (Using Logic Equations) .................................................................. 8
Teaching and Learning Activities.......................................................................................................... 10
Recommended Learning Materials and Resources ........................................................................... 10
Assessment Task ...................................................................................................................................... 10
i
Data Flow Modelling
Learning Outcome
At the end of the lesson, you are expected to:
Learning Content
B. Delays
Regular Assignment Delay
Implicit Continuous Assignment Delay
Net Declaration Delay
D. Example
Dataflow 4-to-1 Multiplexer (Using Logic Equations) 8
1
Data Flow Modelling
A. Continuous Assignments
• the most basic statement in dataflow modeling, used to drive a value onto a net
• replaces gates in the description of the circuit and describes the circuit at a higher
level of abstraction.
• A continuous assignment statement starts with the keyword assign.
: : = assign < drive_strength > ? < delay > ? < list_of_assignments > ;
2
Data Flow Modelling
B. Delays
Delay value control the time between the change in a right-hand-side operand and
when the new value is assigned to the left-hand-side.
Declaration
module regular_delay (out, in1, in2);
I/O port
output out;
input in1, in2;
Delay in a continuous
assign #10 out = in1 & in2;
endmodule
3
Data Flow Modelling
wire OUT;
reg IN1, IN2;
initial
begin
Input test value IN1 = 0; IN2= 0;
#20 IN1=1; IN2= 1;
#40 IN1 = 0;
#40 IN1 = 1;
#5 IN1 = 0;
#150 $stop;
end
initial
Shown the result $monitor("out", OUT, "in1", IN1, "in2",
IN2);
endmodule
i. Verilog Code
module implicit_delay (out, in1, in2);
output out;
Delay in a continuous assign
input in1, in2;
endmodule
4
Data Flow Modelling
module stimulus;
wire OUT;
reg IN1, IN2;
endmodule
iii. Simulation Waveform
output out;
5
Data Flow Modelling
initial
Input test value begin
IN1 = 0; IN2= 0;
#20 IN1=1; IN2= 1;
#40 IN1 = 0;
#40 IN1 = 1;
#5 IN1 = 0;
#150 $stop;
end
endmodule
Expressions
Expressions are constructs that combine operators and operands to produce a result.
addr1[20:17] + addr2[20:17]
in1 | in2
6
Data Flow Modelling
Operands
Operands can be any one of the data types. Some constructs will take only certain
types of operands.
Operators
The operator act on the operands to produce desired results. Verilog provides
various types of operators.
7
Data Flow Modelling
D. Example
endmodule
S1 = 0; S0 = 0;
#1 $display("S1 = %b, S0 = %b, OUTPUT =
Choose IN0 %b \n", S1, S0, OUTPUT);
S1 = 0; S0 = 1;
#1 $display("S1 = %b, S0 = %b, OUTPUT =
Choose IN1
%b \n", S1, S0, OUTPUT);
S1 = 1; S0 = 1;
#1 $display("S1 = %b, S0 = %b, OUTPUT = %b \n",
S1, S0, OUTPUT); 8
Data Flow Modelling
Choose IN2 S1 = 1; S0 = 0;
#1 $display("S1 = %b, S0 = %b, OUTPUT =
%b \n", S1, S0, OUTPUT);
Choose IN3
S1 = 1; S0 = 1;
#1 $display("S1 = %b, S0 = %b, OUTPUT =
%b \n", S1, S0, OUTPUT);
end
endmodule
9
Data Flow Modelling
Assessment Task
***To be uploaded separately.
10