Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17268 Discussions

"gating" one process from another

Altera_Forum
Honored Contributor II
1,397 Views

Hi, 

I am brand new to Verilog. I need to produce a specific bit stream output. The bit time is 0.5us so I have an Always block that executes every 0.5us and creates this bit stream. That is working ok. The problem is that the bit stream is continuous, back to back output. I need to gate it at a low frequency like 10Hz. 

 

I tried creating another Always block that executes every 100ms and set/clears a flag that the Other Always block would read/clear. This does not work as variables cannot be operated on by separate Always blocks. 

 

I am sure there is a fundamental solution, I just don't know the fundamentals. ;-) 

 

Thanks 

 

Rich
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
725 Views

Assuming you're operating from a single clock source, you could implement all of this in a single always block. However, there's nothing wrong with splitting logic up across more than one. This often helps readability. 

 

You can gate the output from block 1 with the control signal you're generating in block 2. A combinatorial statement should do the trick. This could reside in 3rd always block. 

 

Perhaps: 

always @ (*) if (stream_active) // Control signal from always block 2, active every 100ms output_stream = stream_source; // Whilst active, drive the output signal with the stream else output_stream = 0; // Otherwise, turn it off 

 

Regards, 

Alex
0 Kudos
Reply