Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between behavioral and dataflow in verilog

Tags:

verilog

I have searched to understand what is the difference between behavioral and data flow code in verilog. at last i can't find good example for that, everywhere tell the thing that they do. for example :

"Its very simple.Name itself explains what they are.Dataflow is one way of describing the program.Like describing the logical funtion of a particular design. Behavioral model on the other hand describes the behavior of the system.How does it behave when particular input is given?"

here is written very simple example but I need more examples.

like image 879
user3813380 Avatar asked Feb 11 '23 19:02

user3813380


1 Answers

Dataflow modeling in Verilog allows a digital system to be designed in terms of it's function. Dataflow modeling utilizes Boolean equations, and uses a number of operators that can acton inputs to produce outputs operators like + - && & ! ~ || | << >> {} so if i want to describe a 2 to 4 decoder in dataflow modeling i would be like this

module decoder2to4 ( e , a, b, do, dl, d2, d3);
input e, a, b;
output do, dl, d2, d3;
assign dO = ( e & ~a & ~b); //00
assign dl = (e & ~a & b);   //01
assign d2 = (e & a & ~b);   //10
assign d3 = ( e & a & b);   //11
endmodu1e

on the other hand The Behavioral modeling in Verilog is used to describe the function of a design in an algorithmic manner so if i want to describe a 2 to 4 decoder in dataflow modeling i would be like this

module decoder2to4 (e, i, d);
output [3:0] d;
input [l:0]i;
input e;
reg [3:0] d;
    always @ (i or e) begin
            if (e==l) begin
                case (i)
                       0: d = 4'b 0001;
                       1: d = 4'b 0010;
                       2: d = 4'b 0100;
                       3: d = 4'b 1000;
                      default d = 4'b xxxx;
               endcase
            end
            else
               d = 4'b0000;
    end
endmodule
like image 153
Ahmed Salah Avatar answered Mar 02 '23 20:03

Ahmed Salah