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.

How to use module instances in always block

Status
Not open for further replies.

Muthuraja.M

Advanced Member level 4
Full Member level 1
Joined
Jul 20, 2013
Messages
101
Helped
0
Reputation
0
Reaction score
0
Trophy points
16
Visit site
Activity points
634
Hi friends ,

I want to call the dff module from always block

But it shows an error like undefined veriable..

Pls rectify my problem...

Thanks in advance ..
 

Why, exactly, would you want to that? Assuming you wrote a module for the flip flip, Why not just instantiate the FF module directly in another module? As long as you do not instantiate it in an always or initial block.

r.b.
 

Why, exactly, would you want to that? Assuming you wrote a module for the flip flip, Why not just instantiate the FF module directly in another module? As long as you do not instantiate it in an always or initial block.

r.b.


In if loop also the flip flop module cant be called. It shows an error like "the generate if condition must be a constant expression "
 

Of course it can't be "called" there.

Verilog is a hardware description language. Instantiating a module is like soldering a chip on a board. Once it is there, it is there forever. That is why you can't instantiate a module inside an if construct, or an always @ block, etc., because that implies conditional existence. That would be like having a PCB where the chips disappear or reappear.

It seems like you think modules are like C functions that are called by the code whenever necessary. This is not the case.

r.b.
 

Thank u i was cleared and i have succeed.

I have one last doubt pls clarify this in verilog how the high impedance "Z" will be assigned for a register...
 

I have one last doubt pls clarify this in verilog how the high impedance "Z" will be assigned for a register...

Well you don't assign Z to a register.

high impedance values can only be assigned to the pins of a device as there are tri-state drivers in cell libraries for the I/O. I'm not even sure if they have tri-state drivers for internal buses. I certainly don't recall seeing them back when I was working on ASIC designs.

I get the impression you have a non-hardware background. If you don't have at least a working knowledge of how hardware is implemented. Like a 374 register in HW is actually 8 registers feeding tri-state drivers. I suggest you read a book on digital logic design before learning Verilog.

Regards
 

Thank u i was cleared and i have succeed.

I have one last doubt pls clarify this in verilog how the high impedance "Z" will be assigned for a register...

Think by register you mean reg type variables. The assignment is done exactly in the same way as assigning 1,0,x. Inside initial or always block, do blocking or non-blocking assignment.
You'll need to assign "Z" values in testbenches or when bidirectional buses are modeled.

always ...
...
buff_out = 1'bz;
...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top