-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SystemVerilog: $typename should return byte, int, shortint, etc.
When given byte, int, shortint, int, longint, $typename needs to return that instead of the expansion.
- Loading branch information
Showing
5 changed files
with
105 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ Author: Daniel Kroening, [email protected] | |
#define CPROVER_VERILOG_TYPES_H | ||
|
||
#include <util/bitvector_types.h> | ||
#include <util/ieee_float.h> | ||
|
||
/// Used during elaboration only, | ||
/// to signal that a symbol is yet to be elaborated. | ||
|
@@ -162,6 +163,13 @@ class verilog_real_typet:public typet | |
{ | ||
return 64; | ||
} | ||
|
||
typet lower() const | ||
{ | ||
typet type = ieee_float_spect::double_precision().to_type(); | ||
type.set(ID_C_verilog_type, ID_verilog_real); | ||
return type; | ||
} | ||
}; | ||
|
||
/// 32-bit floating point | ||
|
@@ -176,6 +184,13 @@ class verilog_shortreal_typet:public typet | |
{ | ||
return 32; | ||
} | ||
|
||
typet lower() const | ||
{ | ||
typet type = ieee_float_spect::single_precision().to_type(); | ||
type.set(ID_C_verilog_type, ID_verilog_shortreal); | ||
return type; | ||
} | ||
}; | ||
|
||
/// 64-bit floating point | ||
|
@@ -190,6 +205,13 @@ class verilog_realtime_typet:public typet | |
{ | ||
return 64; | ||
} | ||
|
||
typet lower() const | ||
{ | ||
typet type = ieee_float_spect::double_precision().to_type(); | ||
type.set(ID_C_verilog_type, ID_verilog_realtime); | ||
return type; | ||
} | ||
}; | ||
|
||
/// 2-state data type, 16-bit signed integer | ||
|
@@ -204,6 +226,13 @@ class verilog_shortint_typet : public typet | |
{ | ||
return 16; | ||
} | ||
|
||
typet lower() const | ||
{ | ||
typet type = signedbv_typet{width()}; | ||
type.set(ID_C_verilog_type, ID_verilog_shortint); | ||
return type; | ||
} | ||
}; | ||
|
||
/// 2-state data type, 32-bit signed integer | ||
|
@@ -221,7 +250,9 @@ class verilog_int_typet : public typet | |
|
||
typet lower() const | ||
{ | ||
return signedbv_typet{width()}; | ||
typet type = signedbv_typet{width()}; | ||
type.set(ID_C_verilog_type, ID_verilog_int); | ||
return type; | ||
} | ||
}; | ||
|
||
|
@@ -237,6 +268,13 @@ class verilog_longint_typet : public typet | |
{ | ||
return 64; | ||
} | ||
|
||
typet lower() const | ||
{ | ||
typet type = signedbv_typet{width()}; | ||
type.set(ID_C_verilog_type, ID_verilog_longint); | ||
return type; | ||
} | ||
}; | ||
|
||
/// 2-state data type, 8-bit signed integer | ||
|
@@ -251,6 +289,13 @@ class verilog_byte_typet : public typet | |
{ | ||
return 8; | ||
} | ||
|
||
typet lower() const | ||
{ | ||
typet type = signedbv_typet{width()}; | ||
type.set(ID_C_verilog_type, ID_verilog_byte); | ||
return type; | ||
} | ||
}; | ||
|
||
/// 2-state data type, for vectors, unsigned | ||
|