Skip to content
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

Xyce/ADMS: Real to integer conversion inconsistent with Accellera standard #40

Open
ngwood opened this issue Sep 7, 2021 · 1 comment

Comments

@ngwood
Copy link

ngwood commented Sep 7, 2021

Xyce/ADMS uses C++ implicit conversion from double to int which performs truncation of the fraction part of the value. This is inconsistent with the Verilog-AMS Language Reference Manual (VAMS-LRM-2.4: 4.2.1.1 Real to integer conversion) which states the following. "Real numbers are converted to integers by rounding the real number to the nearest integer, rather than by truncating it. Implicit conversion takes place when a real number is assigned to an integer. If the fractional part of the real number is exactly 0.5, it shall be rounded away from zero."

Verilog-A (var should be assigned 2):

integer var;

var = 1.5;

C++ (var wrongly assigned 1):

int var=0.0;
//End of Block-local variables
var = 1.5;
@tvrusso
Copy link
Member

tvrusso commented Sep 8, 2021

All the open source ADMS back-ends rely on C or C++ implicit conversion. It may be inconsistent with the LRM, but it is not likely to be something that we address in short order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants