URL
https://opencores.org/ocsvn/iso7816_3_master/iso7816_3_master/trunk
Subversion Repositories iso7816_3_master
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 8 to Rev 9
- ↔ Reverse comparison
Rev 8 → Rev 9
/iso7816_3_master/trunk/test/ComTxDriverTasks.v
1,8 → 1,6
`include "HexStringConversion.v" |
|
//wire txRun,txPending, rxRun, rxStartBit, isTx, overrunErrorFlag, frameErrorFlag, bufferFull; |
//assign {txRun, txPending, rxRun, rxStartBit, isTx, overrunErrorFlag, frameErrorFlag, bufferFull} = COM_statusOut; |
|
|
//low level tasks |
task sendByte; |
input [7:0] data; |
begin |
30,3 → 28,21
end |
endtask |
|
|
//Higher level tasks |
task sendHexBytes; |
input [16*257:0] bytesString; |
integer i; |
reg [15:0] byteInHex; |
reg [7:0] byteToSend; |
begin |
for(i=16*256;i>=0;i=i-16) begin |
byteInHex=bytesString[i+:16]; |
if(16'h0!=byteInHex) begin |
byteToSend=hexString2Byte(byteInHex); |
sendByte(byteToSend); |
end |
end |
end |
endtask |
|
/iso7816_3_master/trunk/test/ComDriverTasks.v
1,3 → 1,4
`include "ComRxDriverTasks.v" |
`include "ComTxDriverTasks.v" |
|
|
|
/iso7816_3_master/trunk/test/HexStringConversion.v
0,0 → 1,27
|
function [7:0] hexString2Byte; |
input [15:0] byteInHexString; |
integer i; |
reg [7:0] hexDigit; |
reg [4:0] nibble; |
begin |
//hexString2Byte=0; |
for(i=0;i<2;i=i+1) begin |
nibble=5'b10000;//invalid |
hexDigit=byteInHexString[i*8+:8]; |
if(("0"<=hexDigit)&&("9">=hexDigit)) |
nibble=hexDigit-"0"; |
if(("a"<=hexDigit)&&("f">=hexDigit)) |
nibble=10+hexDigit-"a"; |
if(("A"<=hexDigit)&&("F">=hexDigit)) |
nibble=10+hexDigit-"A"; |
if(nibble>15) begin |
$display("Invalid input for hex conversion: '%s', hexDigit='%s' (%x), nibble=%d",byteInHexString,hexDigit,hexDigit,nibble); |
$finish; |
end |
hexString2Byte[i*4+:4]=nibble; |
end |
end |
endfunction |
|
|
/iso7816_3_master/trunk/test/tbIso7816_3_Master.v
192,19 → 192,16
end |
//T=0 tpdu stimuli |
initial begin |
receiveAndCheckByte(8'h3B); |
receiveAndCheckByte(8'h00); |
//sendBytes("000C000001");//would be handy, TODO |
sendByte(8'h00); |
sendByte(8'h0C); |
sendByte(8'h00); |
sendByte(8'h00); |
sendByte(8'h01); |
receiveAndCheckByte(8'h0C); |
//sendBytes("55"); |
sendByte(8'h55); |
receiveAndCheckByte(8'h90); |
receiveAndCheckByte(8'h00); |
//receiveAndCheckByte(8'h3B); |
//receiveAndCheckByte(8'h00); |
receiveAndCheckHexBytes("3B00"); |
sendHexBytes("000C000001"); |
//receiveAndCheckByte(8'h0C); |
receiveAndCheckHexBytes("0C"); |
sendHexBytes("55"); |
//receiveAndCheckByte(8'h90); |
//receiveAndCheckByte(8'h00); |
receiveAndCheckHexBytes("9000"); |
end |
initial begin |
// timeout |
/iso7816_3_master/trunk/test/DummyCard.v
109,7 → 109,7
for(i=0;i<tpduHeader[P3_I+7:P3_I];i=i+1) begin |
receiveByte(buffer[i]); |
end |
sendWord(16'h9000); |
sendHexBytes("9000");//sendWord(16'h9000); |
end |
endtask |
|
123,7 → 123,7
for(i=0;i<le;i=i+1) begin |
sendByte(buffer[i]); |
end |
sendWord(16'h9000); |
sendHexBytes("9000");//sendWord(16'h9000); |
end |
endtask |
|
140,8 → 140,7
tsCnt <= tsCnt + 1'b1; |
end else if(sendAtr) begin |
sendAtr<=1'b0; |
sendByte(8'h3B); |
sendByte(8'h00); |
sendHexBytes("3B00"); |
waitEndOfTx; |
end else begin |
//get tpdu |
151,7 → 150,7
case(tpduHeader[7+CLA_I:P2_I]) |
32'h000C0000: writeBufferCmd; |
32'h000A0000: readBufferCmd; |
default: sendWord(16'h6986); |
default: sendHexBytes("6986");//sendWord(16'h6986); |
endcase |
end |
end |
/iso7816_3_master/trunk/test/ComRxDriverTasks.v
34,3 → 34,19
end |
endtask |
|
//Higher level tasks |
task receiveAndCheckHexBytes; |
input [16*257:0] bytesString; |
integer i; |
reg [15:0] byteInHex; |
reg [7:0] byteToCheck; |
begin |
for(i=16*256;i>=0;i=i-16) begin |
byteInHex=bytesString[i+:16]; |
if(16'h0!=byteInHex) begin |
byteToCheck=hexString2Byte(byteInHex); |
receiveAndCheckByte(byteToCheck); |
end |
end |
end |
endtask |
/iso7816_3_master/trunk/sources/RxCore.v
144,7 → 144,7
run <= #1 0; |
end |
end else begin |
parityBit <= #1 oddParity; |
parityBit <= #1 ~oddParity; |
run <= #1 0; |
nextState <= #1 START_STATE; |
end |