Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16704 Discussions

Direct operations on strings will result in synthesis errors.

wenna
Beginner
249 Views

Consider the following code, which fails synthesis.

module test1 (y, clk);
  output wire y;
  input wire clk; 
  wire wire1; 
  assign wire1 = $signed((~""));
  assign y = wire1;
endmodule

 

 

However, when I use a register to store the value before performing operations, it synthesizes successfully.

module test1 (y, clk);
  output wire y;
  input wire clk; 

  wire wire1; 
  reg str = "";
  assign wire1 = $signed(~str);
  assign y = wire1;
endmodule
Labels (1)
0 Kudos
3 Replies
_AK6DN_
Valued Contributor II
213 Views

The compiler is right, you are wrong.

I'm not even sure what you expect  $signed((~"")) to return as a value. It is nonsensical.

You are doing logical bitwise negation on an empty string value. What do YOU expect that to return?

 

reg str = "";
wire wire1 = $signed(~str);

The first line is valid as it defines a one bit register named str that gets an initial value of "" (whatever that is, probably 1'0b but that is a guess).

The second line is valid as it returns the $signed() of the bitwise complement of a one bit register.

0 Kudos
RichardTanSY_Intel
119 Views

The "" in the failing code represents an empty string, which is not a standard numeric literal in Verilog. The bitwise NOT operator ~ applied to a non-numeric type (empty string) is not well-defined and can lead to synthesis issues.

 

In line:

reg str = "";

 

The reg type expects a single-bit value, and "" is treated as an implicit zero or 1'b0 as mentioned by @_AK6DN_ 

 

Regards,

Richard Tan

 

0 Kudos
RichardTanSY_Intel
52 Views

We noticed that we haven't received a response from you regarding the latest previous question/reply/answer, and will now transitioning your inquiry to our community support. We apologize for any inconvenience this may cause and we appreciate your understanding.

 

If you have any further questions or concerns, please don't hesitate to reach out. Please login to ‘https://supporttickets.intel.com’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support.

The community users will be able to help you on your follow-up questions.

 

Thank you for reaching out to us!

 

Best Regards,

Richard Tan


0 Kudos
Reply