FIFO Queue

The FIFO Queue is a handy symbol in SIMPL Windows. It’s not one I use regularly though, so I’m always a little confused by its operation. FIFO stands for “First In, First Out.” As you add elements to the queue, they are removed in the order they were added.

Here’s the demo program I’m going to use:

When Enable is low, pressing any of the Select inputs does nothing. When Enable is high, elements are added to the queue:

Since the queue was empty before we selected element 1, the Top element is now 1. If we Pop this from the queue we get:

I’ve hidden the Text signals for now (we’ll look at them again in a bit).

This makes sense: we popped the item off the top and now have an empty queue again. If we select multiple elements, it looks like this:

If you watch Top, it starts out as 1, then after Pop, it goes to 2, then after another Pop it goes to 3. When we call Pop again, we get 0 because there’s nothing left in our queue. If we hit Clear, our list immediately empties:

Select inputs behave like toggles. If the same element is selected again (1 in this case), it clears it from the queue. Next, we select 1, then 2, then 3. Top is 1 and Queue_Size is 3. If we select 1 again it is removed from the queue, Top becomes 2, and Queue_Size becomes 2:

If we select 1 again, it is added to the end of the queue:

Enable does not affect Pop or Clear:

I couldn’t get the Text signals to recall correctly on a 3-series processor. Maybe this isn’t supported anymore?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s