Line 1... |
Line 1... |
/*
|
/*
|
Author: Sebastien Riou (acapola)
|
Author: Sebastien Riou (acapola)
|
Creation date: 22:22:43 01/10/2011
|
Creation date: 22:22:43 01/10/2011
|
|
|
$LastChangedDate: 2011-03-07 14:17:52 +0100 (Mon, 07 Mar 2011) $
|
$LastChangedDate: 2011-04-17 23:31:29 +0200 (Sun, 17 Apr 2011) $
|
$LastChangedBy: acapola $
|
$LastChangedBy: acapola $
|
$LastChangedRevision: 18 $
|
$LastChangedRevision: 19 $
|
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/test/iso7816_3_t0_analyzer.v $
|
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/test/iso7816_3_t0_analyzer.v $
|
|
|
This file is under the BSD licence:
|
This file is under the BSD licence:
|
Copyright (c) 2011, Sebastien Riou
|
Copyright (c) 2011, Sebastien Riou
|
|
|
Line 96... |
Line 96... |
//integer COM_errorCnt;
|
//integer COM_errorCnt;
|
//wire txPending=1'b0;
|
//wire txPending=1'b0;
|
//wire txRun=1'b0;
|
//wire txRun=1'b0;
|
|
|
wire rxRun, rxStartBit, overrunErrorFlag, frameErrorFlag, bufferFull;
|
wire rxRun, rxStartBit, overrunErrorFlag, frameErrorFlag, bufferFull;
|
//assign overrunErrorFlag = overrunError;
|
assign overrunErrorFlag = overrunError;
|
assign frameErrorFlag = frameError;
|
assign frameErrorFlag = frameError;
|
|
|
wire [7:0] rxData;
|
wire [7:0] rxData;
|
reg ackFlags;
|
reg ackFlags;
|
|
|
Line 252... |
Line 252... |
if(4'h0==tdiCnt) begin//this is T0
|
if(4'h0==tdiCnt) begin//this is T0
|
atrK <= dataOut[3:0];
|
atrK <= dataOut[3:0];
|
end
|
end
|
tempBytesCnt <= 2'h0;
|
tempBytesCnt <= 2'h0;
|
tdiStruct <= {tdiCnt+1'b1,dataOut};
|
tdiStruct <= {tdiCnt+1'b1,dataOut};
|
if(12'h0=={dataOut,atrK}) begin
|
//if(12'h0=={dataOut,atrK}) begin
|
|
// atrCompleted <= 1'b1;
|
|
// {waitCardTx,waitTermTx}<=2'b01;
|
|
//end
|
|
if((1'b0==tdiStruct[7]) |//we just received the last interface byte
|
|
(4'b0==dataOut[7:4])) begin //or new TDi indicate no further interface bytes
|
|
//fsmState <= (4'b0!=earlyAtrK) ? ATR_HISTORICAL :
|
|
// atrHasTck ? ATR_TCK : T0_HEADER;
|
|
if(4'b0!=earlyAtrK) begin
|
|
fsmState <= ATR_HISTORICAL;
|
|
end else if(atrHasTck) begin
|
|
fsmState <= ATR_TCK;
|
|
end else begin
|
|
fsmState <= T0_HEADER;
|
atrCompleted <= 1'b1;
|
atrCompleted <= 1'b1;
|
{waitCardTx,waitTermTx}<=2'b01;
|
{waitCardTx,waitTermTx}<=2'b01;
|
end
|
end
|
if((1'b0==tdiStruct[7]) |//we just received the last interface byte
|
|
(4'b0==dataOut[7:4])) begin //or new TDi indicate no further interface bytes
|
|
fsmState <= (4'b0!=earlyAtrK) ? ATR_HISTORICAL :
|
|
atrHasTck ? ATR_TCK : T0_HEADER;
|
|
end else begin//TDi, i from 1 to 15
|
end else begin//TDi, i from 1 to 15
|
fsmState <= ATR_TDI;
|
fsmState <= ATR_TDI;
|
end
|
end
|
|
|
end else begin //TA, TB or TC bytes
|
end else begin //TA, TB or TC bytes
|