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

-fclash-force-undefined produces invalid values for BitVector with undefined bits. #2360

Closed
lmbollen opened this issue Nov 18, 2022 · 1 comment · Fixed by #2378
Closed
Labels

Comments

@lmbollen
Copy link
Contributor

Title says it all I think.

Reproducer:

module Example.Project where

import Clash.Prelude

topEntity ::(BitVector 8)
topEntity = deepErrorX "broken"

compiled with cabal run -- clash --verilog Example.Project -fclash-force-undefined=0, produces:

/* AUTOMATICALLY GENERATED VERILOG-2001 SOURCE CODE.
** GENERATED BY CLASH 1.6.4. DO NOT MODIFY.
*/
`timescale 100fs/100fs
module topEntity
    ( // No inputs

      // Outputs
      output wire [7:0] result
    );


  assign result = 8'b'0''0''0''0''0''0''0''0'; // invalid value


endmodule

HDL was generated with 1.6.4, but the problem was encountered with 1.7.0.
Problem also exists for systemverilog and vhdl.

@lmbollen lmbollen added the bug label Nov 18, 2022
lmbollen added a commit to bittide/bittide-hardware that referenced this issue Nov 18, 2022
Partially undefined calendars do not synthesize and -fclash-force-undefined is broken for BitVectors clash-lang/clash-compiler#2360 .
martijnbastiaan pushed a commit to bittide/bittide-hardware that referenced this issue Nov 21, 2022
Partially undefined calendars do not synthesize and `-fclash-force-undefined`
is broken for `BitVector`s, see:

    clash-lang/clash-compiler#2360 .
martijnbastiaan pushed a commit to bittide/bittide-hardware that referenced this issue Nov 21, 2022
Partially undefined calendars do not synthesize and `-fclash-force-undefined`
is broken for `BitVector`s, see:

    clash-lang/clash-compiler#2360 .
martijnbastiaan pushed a commit to bittide/bittide-hardware that referenced this issue Nov 21, 2022
Partially undefined calendars do not synthesize and `-fclash-force-undefined`
is broken for `BitVector`s, see:

    clash-lang/clash-compiler#2360 .
hiddemoll pushed a commit to bittide/bittide-hardware that referenced this issue Nov 21, 2022
Partially undefined calendars do not synthesize and `-fclash-force-undefined`
is broken for `BitVector`s, see:

    clash-lang/clash-compiler#2360 .
alex-mckenna added a commit that referenced this issue Dec 17, 2022
When rendering bit literals, we use the `char` function from the
prettyprinter in most cases. For undefined bits we were using the
`int` function, and wrapping in single quotes. This is not the same:
the `char` function prints a single Haskell `Char`, but does _not_
wrap that character in quotes.

Simply removing the quote marks solves the issue.

Fixes #2360.
alex-mckenna added a commit that referenced this issue Dec 17, 2022
When rendering bit literals, we use the `char` function from the
prettyprinter in most cases. For undefined bits we were using the
`int` function, and wrapping in single quotes. This is not the same:
the `char` function prints a single Haskell `Char`, but does _not_
wrap that character in quotes.

Simply removing the quote marks solves the issue.

Fixes #2360.
alex-mckenna added a commit that referenced this issue Dec 18, 2022
When rendering bit literals, we use the `char` function from the
prettyprinter in most cases. For undefined bits we were using the
`int` function, and wrapping in single quotes. This is not the same:
the `char` function prints a single Haskell `Char`, but does _not_
wrap that character in quotes.

Simply removing the quote marks solves the issue.

Fixes #2360.
martijnbastiaan pushed a commit that referenced this issue Dec 19, 2022
When rendering bit literals, we use the `char` function from the
prettyprinter in most cases. For undefined bits we were using the
`int` function, and wrapping in single quotes. This is not the same:
the `char` function prints a single Haskell `Char`, but does _not_
wrap that character in quotes.

Simply removing the quote marks solves the issue.

Fixes #2360.
@christiaanb
Copy link
Member

We've released v1.8.0, which includes a fix for this issue.

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 a pull request may close this issue.

2 participants