Add queue inside flip flop

In reply to Ken Tsang:

Is the code with the queue supposed to go into the FPGA(synthesized), or is it being used to test the FPGA? Some synthesis tools do not support queue arrays.

The rule about block assignments in flip-flop (always) blocks is slightly more involved. It’s OK to use a blocking assignment to a variable if the variable is only used within the block. You need to use non-blocking assignments when one block writes and another block reads the same variable, and both blocks are synchronized to the same clock. This prevents simulation races because the block that reads needs a guarantee that it gets the old value.