FPGARelated.com
Forums

Code

Started by Lynam 5 years ago7 replieslatest reply 5 years ago62 views

Post deleted by author

[ - ]
Reply by martinthompsonApril 5, 2019

Take it in steps.  First the xo assignment is the same every time through the loop, so let's hoist that up:

xo <= s0o & s1o & s2o & s3o;
for i in 0 to 3 generate
  beginmixOut(32*(i+1)-1 downto 32*i) <= xo;
end generate

Now we can unroll the loop in our mind:

xo <= s0o & s1o & s2o & s3o;

-- i = 0:   beginmixOut(32*(0+1)-1 downto 32*0) <= xo; 
beginmixOut(31 downto 0) <= xo;
-- i = 1:   beginmixOut(32*(1+1)-1 downto 32*1) <= xo; 
beginmixOut(63 downto 32) <= xo; 
-- i = 2:   beginmixOut(32*(2+1)-1 downto 32*2) <= xo; 
beginmixOut(95 downto 64) <= xo; 
-- i = 3:   beginmixOut(32*(3+1)-1 downto 32*3) <= xo; 
beginmixOut(127 downto 96) <= xo;

 

As someone else pointed out, it's the same effect as concatenating xo 4 times into the destination vector:

beginmixOut <= x0 & xo & xo & xo;

which would be my preferred syntax!

[ - ]
Reply by LynamApril 5, 2019

Post deleted by author

[ - ]
Reply by martinthompsonApril 5, 2019

Just plain old multiplication, like in other contexts (and most other languages I can think of :)

[ - ]
Reply by LynamApril 5, 2019

Thanks so much man. Alot clearer now


[ - ]
Reply by istvanvApril 5, 2019

Is this the same? where mixOut is 127 down to 0 and sXo 7 down to 0

mixOut <=  s0o & s1o & s2o & s3o

           & s0o & s1o & s2o & s3o

           & s0o & s1o & s2o & s3o

        & s0o & s1o & s2o & s3o;



[ - ]
Reply by LynamApril 5, 2019

it is the same but i am just unsure of the line

mixOut(32*(i+1)-1 downto 32*i) <= xo;

I am just looking for it to be explained, as i am unsure what it means. Thanks for the quick reply also!

[ - ]
Reply by rajkeerthy18April 5, 2019

The loop is rolled out 4 times to generate a concatenated vector. I assume s0o.. are all 8 bit wide.