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

Error for string.vhdl - Value := resize(slv, Value'length); #48

Open
bhamadicharef opened this issue Aug 18, 2017 · 8 comments
Open

Error for string.vhdl - Value := resize(slv, Value'length); #48

bhamadicharef opened this issue Aug 18, 2017 · 8 comments
Assignees
Labels

Comments

@bhamadicharef
Copy link

bhamadicharef commented Aug 18, 2017

I want to use the function raw_format_slv_hex from string.vhdl.
Vivado 2016.2 gives an error on line 359 about the following

Value := resize(slv, Value'length);

Error message is

[Synth 8-2778] type error near resize ; expected type std_logic_vector

How to fix ? Is it specific to Vivado ?

Brahim @ DCT :: DSI

@bhamadicharef
Copy link
Author

bhamadicharef commented Aug 18, 2017

Seems that it gets fixed by

Value := std_logic_vector(resize(signed(slv), Value'length)); 

@preusser
Copy link
Member

preusser commented Aug 18, 2017

Thanks for your feedback! Please, use the unsigned version of resize to make it semantically correct. Would you want to turn this fix into a pull request then?

@preusser preusser self-assigned this Aug 18, 2017
@preusser preusser added the Bug label Aug 18, 2017
@Paebbels
Copy link
Member

Paebbels commented Aug 18, 2017

The needed resize function is define in utils.vhdl. There is no need to rewrite the code.

The question is why doesn't Vivado 2016.2 find that overload.

@preusser
Copy link
Member

resize on std_logic_vector is ill-defined as it has to make assumptions about signedness. I would rather fence in its use and put it on a deprecation path.

@Paebbels
Copy link
Member

Why is it ill-defined? It makes no assumptions about signedness!

See at the definition in utils, how you wrote it. It's using a fill parameter.

@preusser
Copy link
Member

Yes, and it even has implied semantics using the index direction as a hint for alignment. I would now consider this another feature hard to convey. Although I admittedly tried, std_logic_vector simply does not have an intuitively right semantics for resize. And I do not see why I should not allow my own mistakes to phase out - at least, eventually. The standard libraries provide valid implementations as soon as the types have clear semantics associated with them. Just use those.

@Paebbels
Copy link
Member

Sounds reasonable.

Usage of resize

Where else is that function used?

@preusser
Copy link
Member

Mmhhh, the first of these uses would even be semantically correct ...

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

3 participants