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.

Verilog reg declaration @ and gate output

Status
Not open for further replies.

whenyoureachme

Newbie level 3
Joined
Oct 1, 2006
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,301
Hi All,

I am very new to VERILOG programming as my first program i have wrote an andgate program in the gate level abstraction with inputs x, y and output z. Here is my first program

module andgate (z, x, y);
input x, y;
output z;
wire x, y;
reg z; ---------- // I end up with an Syntax Error if i use this statement.

and (z,x,y);

endmodule


Please help me in understanding the reason why we are unable to declare reg z; at this instance

Thanks in Advance:razz:
 

Should be: wire z;
 

Gate level abstraction is similar to continuous assignment. That means output is valid as long as input is applied, there is no data storage.

When you place register at the output you're trying to store output which is not valid, however, you can use procedural block to achieve this.

Hope this helps
 

Gate level abstraction is similar to continuous assignment. That means output is valid as long as input is applied, there is no data storage.

When you place register at the output you're trying to store output which is not valid, however, you can use procedural block to achieve this.

Hope this helps

Thank U Mr. Jack.
 

verilog basically calls anything that is assigned in an always or initial block a "reg", even if it doesn't infer a register. things assigned outside are generally declared as wire. systemverilog defines a "logic" type that can be used in most cases.
 

permute presents exactly the keypoint

in verilog,reg not equals to a physical register!

And in some case,you must use reg.

Have try,have fun!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top