- Data flow modeling uses continuous assignments and operators to design hardware at a register-transfer level of abstraction by describing the flow of data between registers. It uses assignment statements to continuously assign values to nets based on changes to operands. Some key aspects covered include continuous assignment syntax, implicit assignments, adding delays, and examples of data flow models for common components like adders, multiplexers, and counters.
Download as PPT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
163 views
Data Flow Modelling
- Data flow modeling uses continuous assignments and operators to design hardware at a register-transfer level of abstraction by describing the flow of data between registers. It uses assignment statements to continuously assign values to nets based on changes to operands. Some key aspects covered include continuous assignment syntax, implicit assignments, adding delays, and examples of data flow models for common components like adders, multiplexers, and counters.
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 23
Data Flow Modeling
For complex designs.
Functional Implementation at a higher level of abstraction. Design in terms of the data flow between registers. RTL design for maximum flexibility. (Register Transfer Level->dataflow modeling + behavioral modeling) Dataflow modeling uses a number of operators that act on operands to produce desired results.
Dataflow modeling uses continuous assignments and the keyword assign.
A continuous assignment is a statement that assigns a value to a net.
Continuous Assignments
Syntax: assign #del <id> = <expr>;
Where to write them: inside a module outside procedures
Properties: they all execute in parallel are order independent are continuously active optional net type !! Continuous assignment o Continuous assignment starts with keyword assign. The left hand side of a continuous assignment command must be a net-type signal.
The operands on the right-hand side can be registers or nets or function calls.
Evaluation as soon as one of the right-hand-side operands changes and the value is assigned to the left-hand-side net.
Ex. a b c x AND OR module cir1 (o, a, b, c); output o; input a, b, c; wire x; assign x = a & b; assign o = x | c; endmodule module cir1 (o, a, b, c); output o; input a, b, c; wire x = a & b; assign o = x | c; endmodule OR Implicit Continuous Assignment module cir1 (o, a, b, c); output o; input a, b, c; assign x = a & b; assign o = x | c; endmodule OR Implicit Net Declaration Regular Assignment Delay assign #10 out = in1 & in2; // Delay in a continuous assign. Implicit Continuous Assignment Delay wire #10 out = in1 & in2; same as wire out; assign #10 out = in1 & in2; Net Declaration Delay wire # 10 out; assign out = in1 & in2; same as wire out; assign #10 out = in1 & in2; Adding delay to continuous assignment Expressions, Operators, and Operands
|| Conditional ?: Lowest precedence Arithmetic operators Available operators: +, -, *, /, % (modulo) Arithmetic operators treat register operands as unsigned values Example: integer A; A = -12; A/4 -3 reg [7:0] A; A = -12; A/4 61 Relation and equality operators Available relational operators: <, <=, >, >= If any bit of an operand is X or Z, the result will be X Available equality operators: ===, !==, ==, != = = =, != = : case equality (inequality). X and Z values are considered in comparison = =, != : logic equality (inequality). If any bit of an operand is X or Z, the result will be X
X X 0 1 0XX0 0XX0 X X 1 0 0XX0 0110 0 1 0 1 0110 0110 != == !== === Right Op. Left Op. Example Logic operators Logic operators: && (logic and), || (logic or), ! (logic not) Bit-wise logic operators: & (and), | (or), ~ (not), ^ (xor), ~^ (xnor) Reducation operators: & (and), ~& (nand), | (or), ~| (nor), ^ (xor), ~^ (xnor) 0 ^A 1 0 1 1 0 1010 ~^A ~|A |A ~&A &A Operand A 1001 A^B 0110 0101 1011 0010 0011 1010 A~^B ~A A|B A&B Operand B Operand A 1 0 1 0 00 1010 0 !B 0 1 1 011 1010 !A A|B A&B Operand B Operand A Shift operators << : shift left >> : shift right reg [3:0] A; 1 1 0 1 A << 2 0 1 0 0 zeros are moved in from the right end reg [3:0] A; 1 1 0 1 A >> 2 0 0 1 1 Concatenation operators Example reg [7:0] A, B, Data; reg c;
A = 10101101; B= 00110011; c = 0; Data = {A[3:0], B[7:6], c, c}; // Data = 11010000 1 1 0 1 0 0 0 0 Data A[3:0] B[7:6] c c Replication Operator
For repetitive concatenation of the same number.
A replication constant specifies how many times to replicate the number inside the brackets ( { } ).
A = 1'b1; B = 2'b00; C = 2'b10; D = 3'b110;
Y = { 4{A} } // Result Y is 4'b1111
Y = { 4{A} , 2{B} } // Result Y is 8'b11110000
Y = { 4{A} , 2{B} , C } // Result Y is 10'b1111000010 Conditional Operator The conditional operator(?:) is a ternary operator. Usage: condition_expr ? true_expr : false_expr ; Ex.2-to-1mux assign out = control ? in1 : in0;
If the condition expression is x then true_expr and false_expr are evaluated.
Results are compared, bit by bit, to return for each bit position an x if the bits are different and the value of the bits if they are the same. EXAMPLES
//Dataflow description of 4-bit adder module binary_adder (A,B,Cin,SUM,Cout); input [3:0] A,B; input Cin; output [3:0] SUM; output Cout; assign {Cout,SUM} = A + B + Cin; endmodule
//Dataflow description of 2-to-1-line multiplexer module mux2_1_df (A,B,select,OUT); input A,B,select; output OUT; assign OUT = select ? A : B; //(~select & B) | (select & A); endmodule
4_1 mux? Dataflow description of a 2-to-4-line decoder module decoder_df (A,B,D); input A,B; output [3:0] D; assign D[0] = ~A & ~B, D[1] = ~A & B, D[2] = A & ~B, D[3] = A & B; endmodule