- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page