-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unit_t
in ext_fn_t input generates invalid verliog
#11
Comments
Yeah, the unit_t type is poorly supported both in Cuttlesim and in the verilog pretty-printer, mostly because it's not always OK to eliminate the corresponding expressions (since they might have side-effects, even though they "shouldn't"). I usually solve this case-by-case. Eliminating unit arguments would be relatively easy, but what's the right way to deal with unit_t returns? (Maybe that's actually not an issue because unit_t returns will be dropped by the optimizer anyway) I'm not sure I'll have time to look into fixing this soon; is it acceptable in your case to add a non-zero bits argument? (You typically need one to pass an enable signal to the function) |
Yes thats fine, its not a pressing issue for me, I thought I'd just report it for tracking purposes.
Eliding the |
Additionally Lines 113 to 117 in 61c3587
FWIW, yosys doesn't accept the zero sized version |
Thanks, I'll investigate this.
Isn't that because a plain 0 is really a 32-bits 0? Would it behave correctly in a concat, for example? |
I believe that is correct - the official specification says it is to be a signed value of at least 32 bits. It would only be a valid substitution in some cases such as constant indexing. |
Ah, yes, this is due to selection into single-bit variables begin a no-op; good catch. |
This part should be fixed, at least in simple cases; can you check? (Of course, a sign extension on a one bit word is just a repeat, so it would work to use that, too) |
Yes it looks fixed for me thanks. |
Perhaps not conventional usage but currently
unit_t
/bits_t 0
sized input from an external function generates invalid Verilog. e.g.Generated verilog with
efr_internal := false
:Note the
output wire[-1:0] f1_arg
output wire[-1:0] f2_arg
and alsoassign f1_arg = 0'b0;
assign 21_arg = 0'b0;
are invalid as constants cannot be zero length (IEEE 1800-2012 - 5.7 Numbers).Generated verilog with
efr_internal := true
:Note
.arg(0'b0)
again is a zero sized constant.The text was updated successfully, but these errors were encountered: