Commit eb93ba67 by Zachary Snow

integer atom explicit sign cast support

parent a8346f2f
...@@ -162,4 +162,9 @@ typeSigning :: Type -> Maybe Signing ...@@ -162,4 +162,9 @@ typeSigning :: Type -> Maybe Signing
typeSigning (Net _ sg _) = Just sg typeSigning (Net _ sg _) = Just sg
typeSigning (Implicit sg _) = Just sg typeSigning (Implicit sg _) = Just sg
typeSigning (IntegerVector _ sg _) = Just sg typeSigning (IntegerVector _ sg _) = Just sg
typeSigning (IntegerAtom t sg ) =
Just $ case (sg, t) of
(Unspecified, TTime) -> Unsigned
(Unspecified, _ ) -> Signed
(_ , _ ) -> sg
typeSigning _ = Nothing typeSigning _ = Nothing
...@@ -120,10 +120,10 @@ nullRange t rs1 = ...@@ -120,10 +120,10 @@ nullRange t rs1 =
(tf, rs2) = typeRanges t' (tf, rs2) = typeRanges t'
elaborateIntegerAtom :: Type -> Type elaborateIntegerAtom :: Type -> Type
elaborateIntegerAtom (IntegerAtom TInt sg) = baseIntType sg Signed 32 elaborateIntegerAtom (IntegerAtom TInt sg) = baseIntType sg Signed 32
elaborateIntegerAtom (IntegerAtom TShortint sg) = baseIntType sg Signed 16 elaborateIntegerAtom (IntegerAtom TShortint sg) = baseIntType sg Signed 16
elaborateIntegerAtom (IntegerAtom TLongint sg) = baseIntType sg Signed 64 elaborateIntegerAtom (IntegerAtom TLongint sg) = baseIntType sg Signed 64
elaborateIntegerAtom (IntegerAtom TByte sg) = baseIntType sg Unspecified 8 elaborateIntegerAtom (IntegerAtom TByte sg) = baseIntType sg Signed 8
elaborateIntegerAtom other = other elaborateIntegerAtom other = other
-- makes a integer "compatible" type with the given signing, base signing and -- makes a integer "compatible" type with the given signing, base signing and
......
...@@ -33,4 +33,12 @@ module top; ...@@ -33,4 +33,12 @@ module top;
$display("%b", 5'(1'sb1)); $display("%b", 5'(1'sb1));
end end
parameter W = 9;
initial begin
byte i = -1;
byte unsigned j = -1;
$display("%b", W'(i));
$display("%b", W'(j));
end
endmodule endmodule
...@@ -36,4 +36,18 @@ module top; ...@@ -36,4 +36,18 @@ module top;
$display("%b", 5'sb11111); $display("%b", 5'sb11111);
end end
parameter W = 9;
initial begin : block
reg signed [7:0] i;
reg [7:0] j;
reg [8:0] i_extended;
reg [8:0] j_extended;
i = -1;
j = -1;
i_extended = i;
j_extended = j;
$display("%b", i_extended);
$display("%b", j_extended);
end
endmodule endmodule
...@@ -66,7 +66,7 @@ assertConverts() { ...@@ -66,7 +66,7 @@ assertConverts() {
assertFalse "conversion of $ac_file still contains dimension queries" $? assertFalse "conversion of $ac_file still contains dimension queries" $?
echo "$filtered" | egrep "\s(int\|bit\|logic\|byte\|struct\|enum\|longint\|shortint)\s" echo "$filtered" | egrep "\s(int\|bit\|logic\|byte\|struct\|enum\|longint\|shortint)\s"
assertFalse "conversion of $ac_file still contains SV types" $? assertFalse "conversion of $ac_file still contains SV types" $?
echo "$filtered" | grep "[^$]unsigned" > /dev/null echo "$filtered" | grep "[^\$a-zA-Z_]unsigned" > /dev/null
assertFalse "conversion of $ac_file still contains unsigned keyword" $? assertFalse "conversion of $ac_file still contains unsigned keyword" $?
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment