Skip to content

Support for negative valued float constant #2644

@Abhilekhgautam

Description

@Abhilekhgautam

I was trying to lower to verilog from a calyx program that had negative float values.

I got hit with a parse error:

fud2 cnn.futil -o cnn.sv
FAILED: [code=1] ../cnn.sv 
/home/u/calyx/target/debug/calyx -l /home/u/calyx -b verilog  ../cnn.futil > ../cnn.sv
Error: ../cnn.futil
872 |    cst_2 = std_float_const(0, 32, -999999995904.000000);
       |                                                        ^ Parse error
expected bitwidth or float
ninja: build stopped: subcommand failed.
Error: ninja exited with exit status: 1

I think the grammar has a missing - sign:

// Floating-point numbers are only supported within the `std_float_const` primitive.
float =   @{ ASCII_DIGIT+ ~ ("." ~ ASCII_DIGIT+)? }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions