Lecture14W_F

Lecture14W_F - Circular FIFO Queue Operations Enqueue (EnQ)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Circular FIFO Queue Operations Enqueue (EnQ) If (NumberQueued < QueueSize) { /* Queue not full */ Insert new element at memory location pointed by InPointer Increment InPointer past queue item, (use post increment when inserting) Increment NumberQueued If InPointer points outside queue buffer, QueuePast { Adjust InPointer to start of queue buffer, QueueStart } Reflect successful enqueue in CCR: Clear carry bit } Else { /* Queue full */ Reflect unsuccessful enqueue in CCR: Set carry bit } Full If (NumberQueued < QueueSize) { /* Queue not full */ Reflect non-full queue in CCR: Clear carry bit } Else { /* Queue full */ Reflect full queue in CCR: Set carry bit } Page 1 of 2 Circular FIFO Queue Page 2 of 2 Dequeue (DeQ) If (NumberQueued > 0) { /* Queue not empty */ Get queue item at OutPointer Increment OutPointer past queue item, (use post increment when removing) Decrement NumberQueued If OutPointer points outside queue buffer, QueuePast { Adjust OutPointer to start of queue buffer, QueueStart */ } Reflect successful dequeue in CCR: Clear carry bit } Else { /* Queue empty */ Reflect unsuccessful dequeue in CCR: Set carry bit } Empty If (NumberQueued > 0) { /* Queue not empty */ Reflect non-empty queue in CCR: Clear carry bit } Else { /* Queue empty */ Reflect empty queue in CCR: Set carry bit } ...
View Full Document

Ask a homework question - tutors are online