Line 57... |
Line 57... |
NextCounter <= to_unsigned(0, NextCounter'length);
|
NextCounter <= to_unsigned(0, NextCounter'length);
|
NextState <= toState;
|
NextState <= toState;
|
end if;
|
end if;
|
end procedure NextStateWhenAllSent;
|
end procedure NextStateWhenAllSent;
|
|
|
|
|
|
|
procedure SendBitsAndCalcCrc (signal container : in std_ulogic_vector; constant toState : in aSdCmdState) is
|
|
begin
|
begin
|
ioCmd <= container(to_integer(NextCounter));
|
-- CRC calculation needs one cycle. Therefore we have to start it
|
CrcData <= container(to_integer(NextCounter));
|
-- ahead of putting the data on ioCmd.
|
CrcDataIn <= cActivated;
|
|
NextStateWhenAllSent(container'length, toState);
|
|
end procedure SendBitsAndCalcCrc;
|
|
|
|
|
-- defaults
|
begin
|
|
NextState <= State;
|
NextState <= State;
|
NextCounter <= Counter;
|
NextCounter <= Counter;
|
ioCmd <= 'Z';
|
ioCmd <= 'Z';
|
CrcClear <= cInactivated;
|
CrcClear <= cInactivated;
|
CrcDataIn <= cInactivated;
|
CrcDataIn <= cInactivated;
|
Line 93... |
Line 86... |
|
|
when transbit =>
|
when transbit =>
|
ioCmd <= cSdTransBitHost;
|
ioCmd <= cSdTransBitHost;
|
NextState <= cmdid;
|
NextState <= cmdid;
|
CrcDataIn <= cActivated;
|
CrcDataIn <= cActivated;
|
CrcData <= iCmdContent.id(to_integer(NextCounter));
|
CrcData <= iCmdContent.id(0);
|
|
|
when cmdid =>
|
when cmdid =>
|
-- SendBitsAndCalcCrc(iCmdContent.id, arg);
|
|
ioCmd <= iCmdContent.id(to_integer(NextCounter));
|
ioCmd <= iCmdContent.id(to_integer(NextCounter));
|
if (NextCounter < iCmdContent.id'length-2) then
|
if (NextCounter < iCmdContent.id'length-2) then
|
CrcData <= iCmdContent.id(to_integer(NextCounter)+1);
|
CrcData <= iCmdContent.id(to_integer(NextCounter)+1);
|
else
|
else
|
CrcData <= iCmdContent.arg(0);
|
CrcData <= iCmdContent.arg(0);
|
Line 108... |
Line 100... |
CrcDataIn <= cActivated;
|
CrcDataIn <= cActivated;
|
NextStateWhenAllSent(iCmdContent.id'length, arg);
|
NextStateWhenAllSent(iCmdContent.id'length, arg);
|
|
|
|
|
when arg =>
|
when arg =>
|
-- SendBitsAndCalcCrc(iCmdContent.arg, crc);
|
|
ioCmd <= iCmdContent.arg(to_integer(NextCounter));
|
ioCmd <= iCmdContent.arg(to_integer(NextCounter));
|
if (NextCounter < iCmdContent.arg'length-2) then
|
if (NextCounter < iCmdContent.arg'length-2) then
|
CrcData <= iCmdContent.arg(to_integer(NextCounter)+1);
|
CrcData <= iCmdContent.arg(to_integer(NextCounter)+1);
|
CrcDataIn <= cActivated;
|
CrcDataIn <= cActivated;
|
else
|
else
|