File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -1839,7 +1839,7 @@ fn concat() {
18391839 o: output logic<16>,
18401840 o2: output logic<16>,
18411841) {
1842- assign o = {8'hff + 8'h1};
1842+ assign o = {8'hff + 8'h1};
18431843 assign o2 = {8'hf0, 8'hff + 8'h1};
18441844}
18451845 "# ;
@@ -1927,3 +1927,29 @@ module Top {
19271927"# ;
19281928 check_ir ( code, exp) ;
19291929}
1930+
1931+ #[ test]
1932+ fn binary_operation_with_large_width_variable ( ) {
1933+ let code = r#"
1934+ module Top (
1935+ a: input logic<65>,
1936+ b: output logic ,
1937+ ) {
1938+ always_comb {
1939+ b = a == '0;
1940+ }
1941+ }
1942+ "# ;
1943+
1944+ let exp = r#"module Top {
1945+ input var0(a): logic<65> = 65'hxxxxxxxxxxxxxxxxx;
1946+ output var1(b): logic = 1'hx;
1947+
1948+ comb {
1949+ var1 = (var0 == '0);
1950+ }
1951+ }
1952+ "# ;
1953+
1954+ check_ir ( code, exp) ;
1955+ }
Original file line number Diff line number Diff line change @@ -752,7 +752,7 @@ impl Value {
752752 }
753753
754754 pub fn expand ( & self , width : usize , use_sign : bool ) -> Cow < ' _ , Self > {
755- if self . width ( ) == 0 || self . width ( ) >= width {
755+ if ( self . width ( ) == 0 && width <= 64 ) || self . width ( ) >= width {
756756 Cow :: Borrowed ( self )
757757 } else if width > 64 {
758758 let ret = match self {
You can’t perform that action at this time.
0 commit comments