-
Notifications
You must be signed in to change notification settings - Fork 19
Verilog: aval/bval lowering of 4-valued logic #561
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
Conversation
@@ -1,20 +1,20 @@ | |||
module main(input clk, x, y); | |||
|
|||
reg [1:0] cnt1; | |||
reg z; | |||
reg result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am assuming this was just drive-by cleanup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, z
could be read as high-impedance state.
src/verilog/aval_bval_encoding.h
Outdated
#include <util/expr.h> | ||
|
||
class bv_typet; | ||
class constant_exprt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit-picking: I'd expect util/bitvector_types.h
and util/std_expr.h
to be included here for bv_typet
and constant_exprt
are returned by value. Or pick the other extreme and also forward-declare class exprt;
and class typet;
.
return result; | ||
} | ||
|
||
bv_typet lower_to_aval_bval(const typet &src) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be a bitvector_typet
instead of just typet
? This will then also avoid the to_bitvector_type
a few lines further down.
src/verilog/aval_bval_encoding.cpp
Outdated
src, from_integer(width, integer_typet()), bv_typet{width}}; | ||
} | ||
|
||
exprt adjust_size(const exprt &src, std::size_t dest_width) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use static
src/verilog/aval_bval_encoding.cpp
Outdated
return src; | ||
} | ||
|
||
exprt combine_aval_bval(const exprt &aval, const exprt &bval, const typet &dest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use static
This introduces the standard aval/bval lowering of Verilog's 4-valued logic into bit vectors.
This introduces the standard aval/bval lowering of Verilog's 4-valued logic into bit vectors.