precompilation 'Vhdl' syntax

Guest
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 .
 
Le vendredi 21 mars 2014 14:28:59 UTC+1, Brian Drummond a écrit :
On Fri, 21 Mar 2014 03:39:48 -0700, olivier90dir wrote:



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



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. .
 
On Fri, 21 Mar 2014 03:39:48 -0700, olivier90dir wrote:

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

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
 

Welcome to EDABoard.com

Sponsor

Back
Top