Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Difference between Logic and Reg in System verilog

Status
Not open for further replies.

nishanthp68

Newbie level 6
Joined
Dec 11, 2011
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,385
Hello ,
Logic and Reg in System verilog are 4 state variables and are of user defined size . What is the difference between them .If none what is the use of having two data types?
 

Legacy.

Verilog initially used the term "Register" for the reg data type, but the 1364-2001 started using the term "Variable" because these things did not always represent a synthesizable register in RTL.

The SUPERLOG language, which was the predecessor to SystemVerilog, created the logic datatype that was slightly different from reg in that it allowed continuous assignments to logic variables, where as Verilog prohibited continuous assignments to reg variables.

SystemVerilog now makes a distinction between datatypes and variables. You can apply a datatype to a variable or a net (wire). However Verilog and SystemVerilog's excessive use of implicit keywords obscures this distinction.

logic A; //is a shortcut for

var logic A;

And

wire A; // is a shortcut for

wire logic A;

The benefit of all this is that you can use typedefs and apply user defined types to add structures and multidimensional arrays to wires. You are also allowed to make a single continuous assignment to a variable of any datatype, so any distinction between logic and reg is now lost.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top