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

Subversion Repositories sdhc-sc-core

[/] [sdhc-sc-core/] [trunk/] [grpSdVerification/] [unitSdCardModel/] [src/] [SdCardModel.sv] - Rev 45

Go to most recent revision | Compare with Previous | Blame | View Log

//
// file: SdCardModel.sv
// author: Rainer Kastl
//
// Models a SDCard for verification
// 

const logic cActivated = 1;
const logic cInactivated = 0;

`define cSDArgWith 32
typedef logic[`cSDArgWith-1:0] SDCommandArg;

typedef enum {
         cSdCmdGoIdleState = 0,
         cSdCmdAllSendCID = 2,
         cSdCmdSendRelAdr = 3,
         cSdCmdSetDSR = 4, // [31:16] DSR
         cSdCmdSelCard = 7, // [31:16] RCA
         cSdCmdSendIfCond = 8, // [31:12] reserved, [11:8] supply voltage, [7:0] check pattern
         cSdCmdSendCSD = 9, // [31:16] RCA
         cSdCmdSendCID = 10, // [31:16] RCA
         cSdCmdStopTrans = 12,
         cSdCmdSendStatus = 13 // [31:16] RCA
} SDCommandId;

typedef enum {
        idle
} SDCardState;

class SDCommandToken;
        SDCommandId id;
        SDCommandArg arg;
endclass

class SDCommandResponse;

endclass

class SDCard;
        SDCardState state;

        function new();
                state = idle;
        endfunction

        task reset();
                state = idle;
        endtask

        task recvCmd(input SDCommandToken cmd, output SDCommandResponse response);
                case (cmd.id)
                        cSdCmdGoIdleState: reset();
                        default: $display("SDCard: CmdId %d not implemented", cmd.id);
                endcase
        endtask

endclass

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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