OpenCores
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
    /iso7816_3_master/trunk/test
    from Rev 11 to Rev 12
    Reverse comparison

Rev 11 → Rev 12

/ComTxDriverTasks.v
52,6 → 52,8
sendByte(data[7:0]);
end
endtask
 
//return when the stop bit of the last byte is starting
task waitEndOfTx;
begin
@(posedge COM_clk)
/FiDiAnalyzer.v
47,18 → 47,18
case(fiCode)
4'b0000: fiStuff = {12'd0372,8'd040};
4'b0001: fiStuff = {12'd0372,8'd050};
4'b0010: fiStuff = {12'd0372,8'd060};
4'b0011: fiStuff = {12'd0372,8'd080};
4'b0100: fiStuff = {12'd0372,8'd120};
4'b0101: fiStuff = {12'd0372,8'd160};
4'b0110: fiStuff = {12'd0372,8'd200};
4'b0010: fiStuff = {12'd0558,8'd060};
4'b0011: fiStuff = {12'd0744,8'd080};
4'b0100: fiStuff = {12'd1116,8'd120};
4'b0101: fiStuff = {12'd1488,8'd160};
4'b0110: fiStuff = {12'd1860,8'd200};
4'b0111: fiStuff = {12'd0000,8'd000};
4'b1000: fiStuff = {12'd0000,8'd000};
4'b1001: fiStuff = {12'd0372,8'd050};
4'b1010: fiStuff = {12'd0372,8'd075};
4'b1011: fiStuff = {12'd0372,8'd100};
4'b1100: fiStuff = {12'd0372,8'd150};
4'b1101: fiStuff = {12'd0372,8'd200};
4'b1001: fiStuff = {12'd0512,8'd050};
4'b1010: fiStuff = {12'd0768,8'd075};
4'b1011: fiStuff = {12'd1024,8'd100};
4'b1100: fiStuff = {12'd1536,8'd150};
4'b1101: fiStuff = {12'd2048,8'd200};
4'b1110: fiStuff = {12'd0000,8'd000};
4'b1111: fiStuff = {12'd0000,8'd000};
endcase
/DummyCard.v
161,8 → 161,8
if(8'hFF==tpduHeader[CLA_I+:8]) begin
//support only PPS8 for the time being
if(32'hFF789778==tpduHeader[7+CLA_I:P2_I]) begin
sendHexBytes("FF789778");
if(32'hFF109778==tpduHeader[7+CLA_I:P2_I]) begin
sendHexBytes("FF109778");
waitEndOfTx;
cyclesPerEtu <= 13'd8-1'b1;
end
/ComDriverTasks.v
33,4 → 33,10
`include "ComRxDriverTasks.v"
`include "ComTxDriverTasks.v"
 
task waitEndOfRun;
begin
@(posedge COM_clk)
wait((txRun|rxRun)==0);
end
endtask
 
/tbIso7816_3_Master.v
222,6 → 222,9
initial begin
tbTestSequenceDone=1'b0;
receiveAndCheckHexBytes("3B00");
sendHexBytes("FF109778");
receiveAndCheckHexBytes("FF109778");
cyclesPerEtu=8-1;
sendHexBytes("000C000001");
receiveAndCheckHexBytes("0C");
sendHexBytes("55");
/iso7816_3_t0_analyzer.v
84,7 → 84,10
localparam P2_I = 8*1;
localparam P3_I = 0;
reg [CLA_I+7:0] tpduHeader;
 
localparam PPS0_I= CLA_I;
localparam PPS1_I= INS_I;
localparam PPS2_I= P1_I;
localparam PPS3_I= P2_I;
//wire COM_clk=isoClk;
//integer COM_errorCnt;
//wire txPending=1'b0;
102,10 → 105,6
wire oddParity = 1'b0;
 
wire [7:0] dataOut = sioHighValue ? rxData : ~rxData;
 
 
//`include "ComRxDriverTasks.v"
 
wire endOfRx;
 
wire stopBit2 = useT0;//1 if com use 2 stop bits --> 12 ETU / byte
173,6 → 172,7
localparam T0_SW1 = 5;
localparam T0_SW2 = 6;
localparam T0_HEADER_PPS = 100;
localparam T0_PPS_RESPONSE = 101;
 
integer fsmState;
 
197,8 → 197,13
bytesCnt<=bytesCnt+1'b1;
end
end
reg ppsValidSoFar;
reg ppsAccepted;
wire ppsDataMatch = (tpduHeader[(CLA_I-(tempBytesCnt*8))+:8]==dataOut);
always @(posedge isoClk, negedge nReset) begin
if(~nReset) begin
ppsValidSoFar<=1'b0;
ppsAccepted<=1'b0;
fiCode<=4'b0001;
diCode<=4'b0001;
useT0<=1'b1;
273,11 → 278,61
tpduHeader[CLA_I+:8]<=dataOut;
tempBytesCnt <= 1;
if(8'hFF==dataOut)
fsmState <= T0_HEADER_PPS;//TODO
fsmState <= T0_HEADER_PPS;
else
fsmState <= T0_HEADER_TPDU;
end
end
T0_HEADER_PPS: begin
if(endOfRx) begin
tpduHeader[(CLA_I-(tempBytesCnt*8))+:8]<=dataOut;
if(3==tempBytesCnt) begin//support only 4 byte PPS
tempBytesCnt <= 8'h0;
fsmState <= T0_PPS_RESPONSE;
{waitCardTx,waitTermTx}<=2'b10;
ppsValidSoFar<=1'b1;
ppsAccepted<=1'b0;
end else begin
tempBytesCnt <= tempBytesCnt+1;
end
end
end
T0_PPS_RESPONSE: begin
if(3==tempBytesCnt) begin//support only 4 byte PPS
if(guardTime) begin
if(ppsValidSoFar & ppsDataMatch) begin
{fiCode,diCode}<=tpduHeader[PPS2_I+:8];
end
end
end
if(endOfRx) begin
ppsValidSoFar<=ppsValidSoFar & ppsDataMatch;
if(3==tempBytesCnt) begin//support only 4 byte PPS
tempBytesCnt <= 8'h0;
fsmState <= T0_HEADER;
{waitCardTx,waitTermTx}<=2'b01;
case(tpduHeader[(PPS1_I-(tempBytesCnt*8))+:8])
8'h11: begin
useT0<=1'b0;
useT1<=1'b1;
useT15<=1'b0;
end
8'h1F: begin
useT0<=1'b0;
useT1<=1'b0;
useT15<=1'b1;
end
default: begin
useT0<=1'b1;
useT1<=1'b0;
useT15<=1'b0;
end
endcase
end else begin
tempBytesCnt <= tempBytesCnt+1;
end
end
end
T0_HEADER_TPDU: begin
if(endOfRx) begin
tpduHeader[(CLA_I-(tempBytesCnt*8))+:8]<=dataOut;

powered by: WebSVN 2.1.0

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