precompilation 'Vhdl' syntax

O

olivier90dir

Hi all,

I vould like to find a good syntaxe for this action :

PeekDat <= X"0000000" & "000" & Data.InitDone when PpAdd = X"05" else
Timer when PpAdd = X"08" else
MiscReg1 when PpAdd = X"26" else
MiscReg2 when PpAdd = X"27" else
CsteVersion when PpAdd = X"10" else
for I in 1 to NB_MSGRX loop
CntRxA.CntComOk(I) when PpAdd = (X"10" + I) else
CntRxA.CntComKo(I) when PpAdd = (X"1A" + I) else
CntRxB.CntComOk(I) when PpAdd = (X"4A" + I) else
CntRxB.CntComKo(I) when PpAdd = (X"50" + I) else
end loop;
else X"00000000";

I don't know if it's possible to add for I .. generte inside this code.
Maybye there are an others syntax

Thank you for your help

Olivier .
 
O

Olivier Dir

Le vendredi 21 mars 2014 14:28:59 UTC+1, Brian Drummond a écrit :
No loop necessary.



PeekDat <= X"0000000" & "000" & Data.InitDone when PpAdd = X"05" else

Timer when PpAdd = X"08" else

...

CntRxA.CntComOk(PpAdd - X"10") when PpAdd > X"10"

and PpAdd <= X"10" + NB_MSGRX else

CntRxA.CntComKo(PpAdd - X"1A") when PpAdd > X"1A"

and PpAdd <= X"1A" + NB_MSGRX else

CntRxB.CntComOk(PpAdd - X"4A") when PpAdd > X"4A"

and PpAdd <= X"4A" + NB_MSGRX else

CntRxB.CntComKo(PpAdd - X"50") when PpAdd > X"50"

and PpAdd <= X"50" + NB_MSGRX else

X"00000000";



Simplify using a function:



function AddrMatch(Addr : whatever; Base : whatever) return boolean is

begin

return Addr > Base and Addr <= Base + NB_MSGRX;

end AddrMatch;



PeekDat <= ...

CntRxA.CntComOk(PpAdd - X"10") when AddrMatch(PpAdd, X"10") else...



And use named constants...



constant RxABase : whatever := X"10";



PeekDat <= ...

CntRxA.CntComOk(RxABase) when AddrMatch(RxABase) else...



- Brian

Thank you for your help !


Good solution !
I like your syntax. .
 

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
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top