Coding timinig relationship

Joined
Mar 17, 2012
Messages
3
Reaction score
0
Hi everybody! I have a question about coding&timing/delay relationship.
Considering a code like this
for index 0 to MAX_N loop
varMatrix:= CONV_INTEGER(matrix(index));
diff := a-varMatrix;
if(diff < VAL) then
c:= coeff(diff);
else
c := 1;
end if;
prod := ker(index)*c;
...
end loop;
where i create a variable for every accessed array element , and considering this code
for index 0 to MAX_N loop
if( abs(a-CONV_INTEGER(matrix(index))) < VAL) then
prod := ker(index)*coeff( a-CONV_INTEGER(matrix(index)) );
else
prod := ker(index);
end if;
...
end loop;
where i use every time that i need the "whole" indexed-array element.
If these two codes have different hardware mapping, which of these two codes are faster?
Code 1 implies a register (thus a delay) for every created variable?
Code 2 implies only that a "wire" is taken from a source?
Sorry if it sounds a bit messy
 
Joined
Jan 29, 2009
Messages
152
Reaction score
0
Intermediate variables don't imply registers, so both codes should be exactly equivalent.

Variables only imply registers when their values are being read while they haven't previously been set in the same clock tick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,850
Latest member
VMRKlaus8

Latest Threads

Top