Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

a question in quartus

I have some questions I have a matlab code which i want to convert it to VHDL code.

The idea in the matlab is using for loop where i compute some matrices by using some vectors I have already constructed.

for example if I have syst_bit=[1 2 3 4 5 .......], parity1=[1 2 3 4 5......] and parity2=[1 2 3 4 5......] I will use for loop as follows

for i=1:256

gamma(i)=syst_bit(i)+parity1(i);-- this is simplification to the real equation

end;

for i=1:256

alpha(i)=syst_bit(i)*gamma(i);-- this is simplification to the real equation

end;

for i=1:256

beta(i)=syst_bit(i)*gamma(i);-- this is simplification to the real equation

end;

Ofcourse in matlab there will be no problem at all since the new values of gamma, alpha or beta will be updated before moving to the next line since it's a high programming language.

This should be done for constant number of times(maybe 6 times) on VHDL while receiving the new input to construct new frames (both are done at the same time)

so my idea is creating the needed adders, multipliers, comparators ......

and using for loop in VHDL and on each loop I should put the input on the input wires of this blocks for example

for i in 0 to 255

wire1<=syst_bit(i);

wire2<=parity1(i);

gamma(i)<=wire3;

end loop;

is this right or not?

23 Replies