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

primitives (clash.sized.vector) #2

Closed
alexin-ivan opened this issue May 5, 2014 · 2 comments
Closed

primitives (clash.sized.vector) #2

alexin-ivan opened this issue May 5, 2014 · 2 comments
Labels
Milestone

Comments

@alexin-ivan
Copy link
Contributor

I think some bug here: https://github.com/christiaanb/clash2/blob/master/primitives/clash.sized.vector.json#L84

Versions:
CAES Language for Synchronous Hardware, version 0.3.0.2
clash-lib-0.3.0.1
clash-prelude-0.5

TestCode:
https://gist.github.com/alexin-ivan/ec568a97cdb27d53fa22#file-fpgamodel-L218

Result:
https://gist.github.com/alexin-ivan/3c6e17eb7f193e3f33b6

Quartus ouput:
Error (10344): VHDL expression error at switchBoxBlock_1.vhdl(66): expression has 32 elements, but must have 17 elements

Patch (just swap tuple elements)

-~RESULT <= (~SYM[1](~SYM[1]'high downto ~LIT[0]),~SYM[1](~LIT[0]-1 downto 0));
+~RESULT <= (~SYM[1](~LIT[0]-1 downto 0), ~SYM[1](~SYM[1]'high downto ~LIT[0]));
@christiaanb
Copy link
Member

Thanks for the bug resport, I think it should be however:

-~RESULT <= (~SYM[1](~SYM[1]'high downto ~LIT[0]),~SYM[1](~LIT[0]-1 downto 0));
+~RESULT <= (~SYM[1](~SYM[1]'high downto (~SYM[1]'high - ~LIT[0] + 1)),~SYM[1]((~SYM[1]'high - ~LIT[0]) downto 0));

As the vsplit Haskell code does not swap the two parts of the tuple either. It's just that the VHDL used the wrong indexing.

@christiaanb
Copy link
Member

Fixed by: 436bfce

@christiaanb christiaanb added the bug label May 8, 2014
@christiaanb christiaanb added this to the 0.3.1 milestone May 14, 2014
leonschoorl pushed a commit that referenced this issue Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants