Skip to content

SystemVerilog: conversion functions #894

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

Merged
merged 1 commit into from
Jan 3, 2025
Merged

Conversation

kroening
Copy link
Member

This adds the conversion functions from 1800-2017 20.5.

@kroening kroening force-pushed the verilog-conversion-functions branch 2 times, most recently from e58075d to 3ce9c1c Compare December 21, 2024 13:39
@kroening kroening marked this pull request as ready for review December 21, 2024 13:40
@kroening kroening force-pushed the verilog-conversion-functions branch 3 times, most recently from d2b7b20 to f945a97 Compare December 26, 2024 15:41
// Not a conversion, just reinterpretation
always assert ($bitstoreal(0)==0.0);
always assert ($bitstoreal('h3ff00000_00000000)==1);
// always assert ($bitstoreal('hc0000000_00000000)==-2.0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// always assert ($bitstoreal('hc0000000_00000000)==-2.0);
// always assert ($bitstoreal('hc0000000_00000000)==-2.0);

// Not a conversion, just reinterpretation
always assert ($bitstoshortreal(0)==0.0);
always assert ($bitstoshortreal('h3f80_0000)==1.0);
// always assert ($bitstoshortreal('hc000_0000)==-2.0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// always assert ($bitstoshortreal('hc000_0000)==-2.0);
// always assert ($bitstoshortreal('hc000_0000)==-2.0);

{
// lower to typecast
DATA_INVARIANT(
arguments.size() == 1, id2string(identifier) + " must have one argument");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
arguments.size() == 1, id2string(identifier) + " must have one argument");
arguments.size() == 1, id2string(identifier) + " takes one argument");

for consistency with the other cases.

@kroening kroening force-pushed the verilog-conversion-functions branch from f945a97 to c02993d Compare January 3, 2025 12:14
This adds the conversion functions from 1800-2017 20.5.
@kroening kroening force-pushed the verilog-conversion-functions branch from c02993d to d935c4e Compare January 3, 2025 12:23
@kroening kroening merged commit 2733cf9 into main Jan 3, 2025
9 checks passed
@kroening kroening deleted the verilog-conversion-functions branch January 3, 2025 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants