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

Incorrect description of shift operators in Chisel Tutorial #57

Open
bqwer opened this issue Jan 7, 2017 · 1 comment
Open

Incorrect description of shift operators in Chisel Tutorial #57

bqwer opened this issue Jan 7, 2017 · 1 comment

Comments

@bqwer
Copy link
Contributor

bqwer commented Jan 7, 2017

Section 5.1 of tutorial describes Fill(), >> and << using undefined functions maxNum(n) and minNum(n)

Chisel CheatSheet for Chisel 2.2 described this operations as one would expect:

z = x << n     ;   wz = wx + n
z = x >> n     ;   wz = wx - n
z = Fill(n, x) ;   wz = wx*n

Then there are dynamic shifts, which take variable as argument.

z = x << y     ;   wz = wx + maxVal(y)
z = x >> y     ;   wz = wx - minVal(y)

They are also correctly described in Chisel CheatSheet for Chisel 2.2
(with definition of maxVal(y) and minVal(y))
But strangely dynamic shifts got omitted in Chisel Tutorial 3.0

Because of all above it is unclear from tutorial how >> and << work.

@bqwer
Copy link
Contributor Author

bqwer commented Jan 7, 2017

And if you go to chisel3.core.Bits you will find that >> and << return same width as left side argument. So correct description is none above, but:

z = x << y     ;   wz = wx
z = x >> y     ;   wz = wx

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

1 participant