- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This code compiles(!).
always @ (posedge clock ) begin state <= NextState; state <= state; state <= 0; end Using the SignalTap it appears that state gets set to 0. Apparently its valid code. Is there a way to at least get a warning out of this? Thank you, SteveLink Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why would you want a warning for perfectly valid code?
The user has to take some responsibility! You may want to invest in a linting tool.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Indeed. Thanks so much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I actually use that method when I want a default value on a signal. That way 'a' will always have a value even if I don't assign it in the if statement.
always@(posedge clk) begin a <= 1'b0; if(something) begin a <= 1'b1; end else if(something else) begin <something that doesn't touch a> end end- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- I actually use that method when I want a default value on a signal. That way 'a' will always have a value even if I don't assign it in the if statement. end --- Quote End --- This seems like a good practice. Now I see the value of such a method. Thank you, Steve

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