OpenCores
URL https://opencores.org/ocsvn/sdhc-sc-core/sdhc-sc-core/trunk

Subversion Repositories sdhc-sc-core

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /sdhc-sc-core/trunk/src
    from Rev 38 to Rev 39
    Reverse comparison

Rev 38 → Rev 39

/grpSd/unitSdCmd/src/SdCmd-Rtl-ea.vhdl
36,7 → 36,7
DataIn : std_ulogic;
Data : std_ulogic;
end record aCrcOut;
 
type aSdCmdOut is record
Crc : aCrcOut;
Controller : aSdCmdToController;
68,11 → 68,11
end process CmdStateReg;
 
-- Comb. process
NextStateAndOutput : process (iFromController, State, Counter)
NextStateAndOutput : process (iFromController, ioCmd, SerialCrc, State, Counter)
 
procedure NextStateWhenAllSent (constant length : in natural; constant toState : in aSdCmdState) is
begin
if (NextCounter < length-1) then
if (Counter < length-1) then
NextCounter <= Counter + 1;
else
NextCounter <= to_unsigned(0, NextCounter'length);
80,6 → 80,14
end if;
end procedure NextStateWhenAllSent;
 
procedure SendBitsAndCalcCrc (signal container : in std_ulogic_vector; constant toState : in aSdCmdState) is
begin
Output.Cmd <= container(to_integer(NextCounter));
Output.Crc.Data <= container(to_integer(NextCounter));
Output.Crc.DataIn <= cActivated;
NextStateWhenAllSent(container'length, toState);
end procedure SendBitsAndCalcCrc;
 
begin
-- CRC calculation needs one cycle. Therefore we have to start it
-- ahead of putting the data on ioCmd.
88,47 → 96,30
NextState <= State;
NextCounter <= Counter;
Output <= cDefaultOut;
 
case State is
when idle =>
if (iFromController.Send = cActivated) then
NextState <= startbit;
Output.Crc.DataIn <= cActivated;
Output.Crc.Data <= cSdStartBit;
end if;
 
when startbit =>
Output.Cmd <= cSdStartBit;
Output.Crc.DataIn <= cActivated;
Output.Crc.Data <= cSdStartBit;
NextState <= transbit;
Output.Crc.DataIn <= cActivated;
Output.Crc.Data <= cSdTransBitHost;
 
when transbit =>
Output.Cmd <= cSdTransBitHost;
Output.Crc.DataIn <= cActivated;
Output.Crc.Data <= cSdTransBitHost;
NextState <= cmdid;
Output.Crc.DataIn <= cActivated;
Output.Crc.Data <= iFromController.Content.id(0);
 
when cmdid =>
Output.Cmd <= iFromController.Content.id(to_integer(NextCounter));
if (NextCounter < aSdCmdId'length-2) then
Output.Crc.Data <= iFromController.Content.id(to_integer(NextCounter)+1);
else
Output.Crc.Data <= iFromController.Content.arg(0);
end if;
Output.Crc.DataIn <= cActivated;
NextStateWhenAllSent(aSdCmdId'length, arg);
SendBitsAndCalcCrc(iFromController.Content.id, arg);
 
 
when arg =>
Output.Cmd <= iFromController.Content.arg(to_integer(NextCounter));
if (NextCounter < aSdCmdArg'length-2) then
Output.Crc.Data <= iFromController.Content.arg(to_integer(NextCounter)+1);
Output.Crc.DataIn <= cActivated;
else
Output.Crc.DataIn <= cInactivated;
end if;
NextStateWhenAllSent(aSdCmdArg'length, crc);
SendBitsAndCalcCrc(iFromController.Content.arg, crc);
 
when crc =>
Output.Cmd <= SerialCrc;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.