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

Dynamic Shift Left #1

Open
Bynaryman opened this issue Nov 21, 2018 · 3 comments
Open

Dynamic Shift Left #1

Bynaryman opened this issue Nov 21, 2018 · 3 comments

Comments

@Bynaryman
Copy link

Could you help me understand the sense of the Dynamic Shift Left ? Why not simply use the "<<" operator directly ? Is it to get better hardware ? Is it to stay generic ? I did a testbench with 16 bits comparing << operator with your module and I get the same values for every possible input

@manish-kj
Copy link
Owner

Hi, sorry for late reply.
You question is related to correctly synthesizable coding.
Dynamic shift left is used to shift a input with variable length. However, The simple "<<" operator will do it for a fixed amount of shifting value. For example if write "A << 5" it will generate a hardware just for 5 bit left shifter, which can not be used any other size shifting amount. I would suggest you to do a post-synthesis simulation of both case, and try to vary the shifting amount variable.

@Bynaryman
Copy link
Author

Hi, thanks to reply !
Actually, the operator "<<" works for a variable shifting amount i.e. a signal in fpga. I guess, right now, tools are able to infer hardware capable of doing that similar the module you propose. I am using vivado 2018.2, but It also works for vivado 2017. I am a young fpga developer, so I did not have to face the old school difficulties of synthesizers. In my modest opinion, I think we can rely on quality of hardware generated by "reg << signal". Don't you think so ?

@manish-kj
Copy link
Owner

I would say, try to see do a post-synthesis verification of the results. It will confirm either of our opinion :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants