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/grpSd
- from Rev 62 to Rev 63
- ↔ Reverse comparison
Rev 62 → Rev 63
/unitSdCardModel/src/SdCardModel.sv
14,6 → 14,7
local virtual ISdCmd.Card ICmd; |
|
local SDCardState state; |
local RCA_t rca; |
local SDCommandToken recvcmd; |
local logic CCS; |
|
25,6 → 26,7
this.CmdReceived = CmdReceived; |
this.InitDone = InitDone; |
this.CCS = 1; |
rca = 0; |
endfunction |
|
task reset(); |
75,6 → 77,7
SDCommandR3 acmd41response; |
SDCommandR2 cidresponse; |
SDOCR ocr; |
SDCommandR6 rcaresponse; |
|
// expect CMD0 so that state is clear |
recv(); |
138,6 → 141,14
cidresponse = new(); |
cidresponse.send(ICmd); |
|
// expect CMD3 |
recv(); |
assert(recvcmd.id == cSdCmdSendRelAdr); |
|
// respond with R3 |
rcaresponse = new(rca, state); |
rcaresponse.send(ICmd); |
|
-> InitDone; |
|
endtask |
/unitSdCardModel/src/SdCardState.sv
11,20 → 11,28
} SDCardStates; |
|
class SDCardState; |
local logic OutOfRange; |
local logic AddressError; |
local logic BlockLenError; |
logic OutOfRange; |
logic AddressError; |
logic BlockLenError; |
logic ComCrcError; |
logic IllegalCommand; |
logic Error; |
logic[3:0] state; |
logic ReadyForData; |
logic AppCmd; |
logic AkeSeqError; |
|
local logic[3:0] state; |
|
local logic AppCmd; |
|
function new(); |
OutOfRange = 0; |
AddressError = 0; |
BlockLenError = 0; |
ComCrcError = 0; |
IllegalCommand = 0; |
Error = 0; |
state = idle; |
ReadyForData = 0; |
AppCmd = 0; |
AkeSeqError = 0; |
endfunction |
|
function void recvCMD55(); |
/unitSdCardModel/src/SdCommand.sv
6,6 → 6,7
// |
`define cSDArgWith 32 |
typedef logic[`cSDArgWith-1:0] SDCommandArg; |
typedef logic[15:0] RCA_t; |
typedef logic[6:0] aCrc; |
|
typedef enum { |
224,3 → 225,25
|
endclass |
|
class SDCommandR6 extends SDCommandResponse; |
|
function new(RCA_t rca, SDCardState state); |
startbit = 0; |
transbit = 0; |
id = cSdCmdSendRelAdr; |
this.arg[31:16] = rca; |
this.arg[15] = state.ComCrcError; |
this.arg[14] = state.IllegalCommand; |
this.arg[13] = state.Error; |
this.arg[12:9] = state.state; |
this.arg[8] = state.ReadyForData; |
this.arg[7:6] = 0; |
this.arg[5] = state.AppCmd; |
this.arg[4] = 0; |
this.arg[3] = state.AkeSeqError; |
this.arg[2:0] = 0; |
endbit = 1; |
endfunction |
|
endclass |
|
/pkgSd/src/Sd-p.vhdl
85,6 → 85,9
function UpdateCID(icid : in aSdRegCID; data : in std_ulogic; pos : in |
natural) return aSdRegCID; |
|
subtype aSdRCA is std_ulogic_vector(15 downto 0); |
constant cDefaultRCA : aSdRCA := (others => '0'); |
|
-- Types for entities |
type aSdCmdFromController is record |
Content : aSdCmdContent; |
/unitSdController/src/SdController-Rtl-ea.vhdl
35,9 → 35,10
type aSdControllerReg is record |
HCS : std_ulogic; |
CCS : std_ulogic; |
RCA : aSdRCA; |
end record aSdControllerReg; |
constant cDefaultSdControllerReg : aSdControllerReg := (cActivated, |
cInactivated); |
cInactivated, cDefaultRCA); |
|
signal Reg, NextReg : aSdControllerReg; |
|
165,8 → 166,21
end if; |
|
when CMD3 => |
null; |
oSdCmd.Content.id <= cSdCmdSendRelAdr; |
oSdCmd.Valid <= cActivated; |
if (iSdCmd.Ack = cActivated) then |
NextState <= CMD3Response; |
end if; |
|
when CMD3Response => |
if (iSdCmd.Valid = cActivated) then |
if (iSdCmd.Content.id = cSdCmdSendRelAdr) then |
-- todo: check status |
NextReg.RCA <= iSdCmd.Content.arg(31 downto 16); |
NextState <= idle; |
end if; |
end if; |
|
when others => |
report "SdController: State not handled" severity error; |
end case; |