Create a 3-byte queue

what is 3-byte queue ?

Create a 3-byte queue and initialize it with 2, −1, and 127
Print out the sum of the queue in the decimal radix

i think this is the correct syntaxbyte queue[$:2];

In reply to Prudhvi Krishna :

that syntax declares an empty queue with a maximum size of two elements.

A “3-byte queue” could mean a number of things. Most likely it means to clear a queue of bytes with three elements initially.

byte queue [$] = {2, −1, 127};



module tb;
  //Create a 3-byte queue and initialize it with 2, −1, and 127
//	Print out the sum of the queue in the decimal radix
  
  byte q [$] = '{2,-1,127};
  int sum;
  

 initial begin
   for (int i=0;i<$size(q);i++) sum = sum + q[i];
   $display ("sum is %d",sum);
 end
  
  
endmodule

In reply to dave_59:

i think that 3 byte queue is a bounded queue with 3 bytes