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

1 Answer 1

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\$
1
  • 1
    \$\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
    Commented Oct 4, 2015 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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