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/unitSdCardModel/src
- from Rev 158 to Rev 159
- ↔ Reverse comparison
Rev 158 → Rev 159
/SdBFM-impl.sv
184,7 → 184,7
|
for (int j = 0; j < 512*2; j++) begin |
@ICard.cb; |
for(int i = 0; i < 4; i++) begin |
for(int i = 3; i >= 0; i--) begin |
block.data.push_back(ICard.cb.Data[i]); |
end |
end |
192,7 → 192,7
// crc |
for (int j = 0; j < 16; j++) begin |
@ICard.cb; |
for(int i = 0; i < 4; i++) begin |
for(int i = 3; i >= 0; i--) begin |
crc[i] = ICard.cb.Data[i]; |
end |
end |
/SdCardModel.sv
32,14 → 32,14
local Logger log; |
|
|
local rand int datasize; // ram addresses = 2^datasize - 1; 512 byte blocks |
constraint cdatasize {datasize > 1; datasize <= 32;} |
//local rand int datasize; // ram addresses = 2^datasize - 1; 512 byte blocks |
//constraint cdatasize {datasize == 32;} |
|
local bit[512*8-1:0] ram[]; |
local bit[0:511][7:0] ram[]; |
|
function void post_randomize() ; |
this.ram = new[2^(datasize-1)]; |
endfunction |
/*function void post_randomize() ; |
this.ram = new[datasize]; |
endfunction*/ |
|
function new(); |
//this.bfm = bfm; |
48,6 → 48,7
rca = 0; |
mode = standard; |
log = new(); |
ram = new[100]; |
endfunction |
|
task start(); |
249,15 → 250,17
|
// expect Read |
assert(token.id == cSdCmdReadSingleBlock); |
addr = token.arg[0]; |
assert(addr < ram.size()); |
addr = token.arg; |
assert(addr <= ram.size()) else log.error("Read outside of available RAM"); |
response = new(cSdCmdReadSingleBlock, state); |
response.DataBlocks = new[1]; |
response.DataBlocks[0] = new(); |
|
//$display("Ram before read (%h): %h", addr, ram[addr]); |
|
for (int i = 0; i < 512; i++) begin |
for (int j = 7; j >= 0; j--) begin |
response.DataBlocks[0].data.push_back(ram[addr][i*8 + j]); |
response.DataBlocks[0].data.push_back(ram[addr][i][j]); |
end |
end |
|
272,7 → 275,7
// expect Write |
assert(token.id == cSdCmdWriteSingleBlock); |
addr = token.arg; |
assert(addr < ram.size()); |
assert(addr <= ram.size()) else log.error("Write outside of available RAM"); |
response = new(cSdCmdWriteSingleBlock, state); |
this.bfm.send(response); |
|
286,7 → 289,8
// write into ram |
for (int i = 0; i < 512; i++) begin |
for (int j = 7; j >= 0; j--) begin |
ram[addr][i * 8 + j] = rdblock.data.pop_front(); |
//$display("rd_front: %d", rdblock.data[0:7]); |
ram[addr][i][j] = rdblock.data.pop_front(); |
end |
end |
|
293,7 → 297,11
this.bfm.waitUntilReady(); |
this.bfm.sendBusy(); |
|
//$display("Ram at write address: %h", ram[addr]); |
//$display("Ram after write (%h): %h", addr, ram[addr]); |
/*$display("Ram after write (%h):", addr); |
for(int i = 0; i < 512; i++) begin |
$display("idx %d: %d", i, ram[addr][i]); |
end*/ |
|
endtask |
|