Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to change array index value according to each clock?

Status
Not open for further replies.

vasireddyrajesh3

Newbie level 6
Newbie level 6
Joined
Oct 17, 2011
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,370
i declared an ARRAY, i will get different outputs in each clock, so that out put i have to store in each index of an ARRAY,
for example for 1st clock if i get "10101010" that should be stored in first INDEX, for next clock if i get output as '00001101' this should be stored in second index value of ARRAY......... like that.

here is the sample code i written.....

type array_encoded_data is array ( 0 to 31 ) of std_logic_vector( 0 to 7);
signal array_encoded_sig : array_encoded_data ;


encoded_data is the output of 1 bit .like this i will get 8 bits from 0 to 7 loop,temp is 8 bit vector.

dout is 8 bit which changes in every clock, pi is 32 bit. so for each clock dout will change ,then encoded_data will also change..

for the 1st clock i am xor ing pi(0) with dout(i)
then for 2nd clock i am xor ing pi(1) with dout(i) ((dout is different in 2nd clock))

like that i want to store each 8 bit encoded_data in each index of ARRAY

if count= 0 then
for i in 0 to 7 loop
encoded_data := ((dout(i)) xor (pi(0)));
temp(i):=encoded_data;

end loop;end if;
array_encoded_sig(0)<=temp;
------------------------------
if count= 1 then
for i in 0 to 7 loop

encoded_data := ((dout(i)) xor (pi(1)));
temp(i):=encoded_data;

end loop;end if;
array_encoded_sig(1)<=temp;


any one help me regarding this.. thanks in advance.
 

You've got legal code there, but wouldnt it be easier to just to write:

Code:
for i in 0 to 7 loop
  encoded_data := (dout(i)) xor (pi(count)));
end loop;

array_encoded_sig(count) <= encoded_data;
 
You've got legal code there, but wouldnt it be easier to just to write:

Code:
for i in 0 to 7 loop
  encoded_data := (dout(i)) xor (pi(count)));
end loop;

array_encoded_sig(count) <= encoded_data;

Dear sir, Thanks for your help.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top