Showing results for 
Show  only  | Search instead for 
Did you mean: 
Registered: ‎04-03-2018

Saving a Flag for Later Use

I am designing a module that will send/receive data and process it. It has two inputs named rx_start and tx_start which are pretty self-explanatory. These inputs receive a pulse for a short duration, which triggers a corresponding sequence of operations. Let's say the design receives a pulse at tx_start and starts performing the required operations. There is a possibility that while these tasks are being performed, it receives a pulse at rx_start. I want to be able to save it in a flag, so at the end of tx operations, the design starts rx operations.



//-----Block 1-----//
if (rx_start) { rx_start_flag = 1; } //-----Block 2-----//
if (tx_start) { tx_start_flag = 1; }
//-----Block 3-----// if (rx_start_flag) { //some rx operations } else if (tx_start_flag) { //some tx operations }

In other words, I want blocks 1, 2, and 3 to run in parallel. I am confused about which directives should I use for this purpose.


0 Kudos
1 Reply
Registered: ‎01-28-2014

C/C++ aren't' really meant to describe this kind of behavior as they are sequential languages. Why not just latch the flags in RTL and clear them when processing is done? 


Note: I'm assuming your Tx/Rx operations are mutually exclusive from your problem description. If they can run in parallel and aren't dependent on each other at all there may be options.

0 Kudos