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
/
- from Rev 58 to Rev 59
- ↔ Reverse comparison
Rev 58 → Rev 59
/sdhc-sc-core/trunk/src/grpSd/unitSdCardModel/src/SDOCR.sv
0,0 → 1,44
// |
// file: SDOCR.sv |
// author: Rainer Kastl |
// |
// Class for OCR register |
// See SD Spec 2.00 page 74 (85 in pdf) |
// |
|
typedef logic[23:15] voltage_t; |
const voltage_t cSdVoltageWindow = 'b111111111; |
const logic cOCRBusy = 0; |
const logic cOCRDone = 1; |
|
class SDOCR; |
local logic[14:0] reserved; // 7 reserved for low voltage |
local voltage_t voltage; |
local logic[29:24] reserved2; |
local logic CCS; |
local logic busy; |
|
function new(logic CCS, voltage_t voltage); |
reserved = 0; |
reserved2 = 0; |
this.CCS = CCS; |
this.voltage = voltage; |
this.busy = cOCRBusy; |
endfunction |
|
function void setBusy(logic busy); |
this.busy = busy; |
endfunction |
|
function automatic SDCommandArg get(); |
SDCommandArg temp = 0; |
temp[31] = busy; |
temp[30] = CCS; |
temp[29:24] = reserved2; |
temp[23:15] = voltage; |
temp[14:0] = reserved; |
return temp; |
endfunction |
|
endclass |
|
/sdhc-sc-core/trunk/src/grpSd/unitSdCardModel/src/SdCardModel.sv
15,6 → 15,7
|
local SDCardState state; |
local SDCommandToken recvcmd; |
local logic CCS; |
|
local event CmdReceived, InitDone; |
|
23,6 → 24,7
state = new(); |
this.CmdReceived = CmdReceived; |
this.InitDone = InitDone; |
this.CCS = 1; |
endfunction |
|
task reset(); |
70,6 → 72,8
task automatic init(); |
SDCommandR7 voltageresponse; |
SDCommandR1 response; |
SDCommandR3 acmd41response; |
SDOCR ocr; |
|
// expect CMD0 so that state is clear |
recv(); |
100,6 → 104,11
assert(recvcmd.id == cSdCmdACMD41); |
assert(recvcmd.arg == cSdArgACMD41HCS); |
|
// respond with R3 |
ocr = new(CCS, cSdVoltageWindow); |
acmd41response = new(ocr); |
acmd41response.send(ICmd); |
|
-> InitDone; |
|
endtask |
/sdhc-sc-core/trunk/src/grpSd/unitSdCardModel/src/SdCommand.sv
171,3 → 171,16
|
endclass |
|
include "../../unitSdCardModel/src/SDOCR.sv"; |
class SDCommandR3 extends SDCommandResponse; |
|
function new(SDOCR ocr); |
startbit = 0; |
transbit = 0; |
this.id = 'b111111; |
this.arg = ocr.get(); |
endbit = 1; |
endfunction |
|
endclass |
|