2
\$\begingroup\$

I wrote a simple code to declare a queue and use it in verilog, but it always gives an error when I use ISE 14.6 synthesize tool.

module queues; 
byte qu [$] ;

initial
begin
qu.push_front(2);
qu.push_front(12);
qu.push_front(22);
qu.push_back(11);
qu.push_back(99);
$display(" %d ",qu.size() );
$display(" %d ",qu.pop_front() );
$display(" %d ",qu.pop_back() );
qu.delete(3);
$display(" %d ",qu.size() );
end
endmodule

These are the errors:

  1. Syntax error near "$"
  2. byte is an unknown type
  3. Module ignored due to previous errors.

So what will be the problem? Is there any library that should be included ??!!

\$\endgroup\$
  • \$\begingroup\$ Should you declare the actual buffer length instead of the using the dollar sign? \$\endgroup\$ – SunnyBoyNY Oct 3 '15 at 14:23
  • \$\begingroup\$ no,i mean by that" it's non-bounded queue not static array " \$\endgroup\$ – sepeee Oct 3 '15 at 17:18
  • \$\begingroup\$ If you were the synthesises, how would you go about make a dynamic sized memory in hardware? \$\endgroup\$ – Tom Carpenter Oct 3 '15 at 19:16
5
\$\begingroup\$

Queues are SystemVerilog and they are not synthesizable. Queues are intended only to be used in simulation for verification and behavioral modeling.

If you want a queue functionality to synthesize, then you must create an fixed sized array and manage the pointer(s).

SystemVerilog and Verilog have features only usable in simulation. They language itself does provide requirements on what should and shouldn't be synthesizable. It is up the the creator of the synthesizer to decide that it can support. Most synthesizers have very similar support (no one wants to be outdone by a competitor). But some stuff is inherently hard or impractical to synthesize. In general to be synthesizable, the definition and attributes need to be static. A queue has a dynamic size therefore not synthesizable.

\$\endgroup\$
  • \$\begingroup\$ A bounded queue declared with a max size like byte [7:0] qu[$:255]; was designed to be synthesizable. There may be one tool that supports it. \$\endgroup\$ – dave_59 Oct 4 '15 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.