OpenCores
URL https://opencores.org/ocsvn/iso7816_3_master/iso7816_3_master/trunk

Subversion Repositories iso7816_3_master

[/] [iso7816_3_master/] [trunk/] [test/] [tbIso7816_3_Master.v] - Diff between revs 14 and 15

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 14 Rev 15
Line 1... Line 1...
/*
/*
Author: Sebastien Riou (acapola)
Author: Sebastien Riou (acapola)
Creation date: 22:16:42 01/10/2011
Creation date: 22:16:42 01/10/2011
 
 
$LastChangedDate: 2011-02-10 16:40:57 +0100 (Thu, 10 Feb 2011) $
$LastChangedDate: 2011-02-13 16:20:10 +0100 (Sun, 13 Feb 2011) $
$LastChangedBy: acapola $
$LastChangedBy: acapola $
$LastChangedRevision: 14 $
$LastChangedRevision: 15 $
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/test/tbIso7816_3_Master.v $
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/test/tbIso7816_3_Master.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 87... Line 87...
wire spy_useIndirectConvention,spy_atrIsEarly,spy_atrIsLate;
wire spy_useIndirectConvention,spy_atrIsEarly,spy_atrIsLate;
wire [3:0] spy_atrK;
wire [3:0] spy_atrK;
wire spy_atrHasTck,spy_atrCompleted;
wire spy_atrHasTck,spy_atrCompleted;
wire spy_useT0,spy_useT1,spy_useT15,spy_waitCardTx,spy_waitTermTx,spy_cardTx,spy_termTx,spy_guardTime;
wire spy_useT0,spy_useT1,spy_useT15,spy_waitCardTx,spy_waitTermTx,spy_cardTx,spy_termTx,spy_guardTime;
wire spy_overrunError,spy_frameError;
wire spy_overrunError,spy_frameError;
 
wire spy_comOnGoing;
wire [7:0] spy_lastByte;
wire [7:0] spy_lastByte;
wire [31:0] spy_bytesCnt;
wire [31:0] spy_bytesCnt;
 
 
        // Instantiate the Unit Under Test (UUT)
        // Instantiate the Unit Under Test (UUT)
        Iso7816_3_Master uut (
        Iso7816_3_Master uut (
Line 165... Line 166...
    .cardTx(spy_cardTx),
    .cardTx(spy_cardTx),
    .termTx(spy_termTx),
    .termTx(spy_termTx),
    .guardTime(spy_guardTime),
    .guardTime(spy_guardTime),
    .overrunError(spy_overrunError),
    .overrunError(spy_overrunError),
    .frameError(spy_frameError),
    .frameError(spy_frameError),
 
    .comOnGoing(spy_comOnGoing),
    .lastByte(spy_lastByte),
    .lastByte(spy_lastByte),
    .bytesCnt(spy_bytesCnt)
    .bytesCnt(spy_bytesCnt)
    );
    );
 
 
 
 
Line 208... Line 210...
                if(atrIsLate) begin
                if(atrIsLate) begin
                        $display("ERROR: ATR is late");
                        $display("ERROR: ATR is late");
                        tbErrorCnt=tbErrorCnt+1;
                        tbErrorCnt=tbErrorCnt+1;
                end
                end
                @(posedge clk);
                @(posedge clk);
                while((txRun===1'b1)||(rxRun===1'b1)||(rxStartBit===1'b1)) begin
                while((1'b0===spy_atrCompleted)||(txRun===1'b1)||(rxRun===1'b1)||(rxStartBit===1'b1)) begin
                        while((txRun===1'b1)||(rxRun===1'b1)||(rxStartBit===1'b1)) begin
                        while((1'b0===spy_atrCompleted)||(txRun===1'b1)||(rxRun===1'b1)||(rxStartBit===1'b1)) begin
                                @(posedge clk);
                                @(posedge clk);
                        end
                        end
                        @(posedge clk);
                        @(posedge clk);
                end
                end
                if(1'b1!==tbTestSequenceDone) begin
                if(1'b1!==tbTestSequenceDone) begin
Line 221... Line 223...
                        #(CLK_PERIOD*372*12);
                        #(CLK_PERIOD*372*12);
                        $finish;
                        $finish;
                end
                end
        end
        end
        //T=0 tpdu stimuli
        //T=0 tpdu stimuli
        reg [7:0] byteFromCard;
        //reg [7:0] byteFromCard;
 
        reg [8*256:0] bytesFromCard;
        initial begin
        initial begin
                tbTestSequenceDone=1'b0;
                tbTestSequenceDone=1'b0;
                //receiveAndCheckHexBytes("3B00");
                //receiveAndCheckHexBytes("3B00");
                receiveByte(byteFromCard);//3B or 3F, so we don't check (Master and Spy do)
                receiveByte(bytesFromCard[7:0]);//3B or 3F, so we don't check (Master and Spy do)
                //receiveAndCheckHexBytes("9497801F42BABEBABE");
                //receiveAndCheckHexBytes("9497801F42BABEBABE");
                //TODO: handle TCK-->receiveAndCheckHexBytes("9E 97 80 1F C7 80 31 E0 73 FE 21 1B 66 D0 00 28 24 01 00 0D");
                //TODO: handle TCK-->receiveAndCheckHexBytes("9E 97 80 1F C7 80 31 E0 73 FE 21 1B 66 D0 00 28 24 01 00 0D");
                receiveAndCheckHexBytes("9E 97 80 1F C7 80 31 E0 73 FE 21 1B 66 D0 00 28 24 01 00");
                receiveAndCheckHexBytes("9E 97 80 1F C7 80 31 E0 73 FE 21 1B 66 D0 00 28 24 01 00");
                sendHexBytes("FF109778");
                sendHexBytes("FF109778");
                receiveAndCheckHexBytes("FF109778");
                receiveAndCheckHexBytes("FF109778");
                cyclesPerEtu=8-1;
                cyclesPerEtu=8-1;
                sendHexBytes("000C000001");
                //sendHexBytes("000C000001");
                receiveAndCheckHexBytes("0C");
                //receiveAndCheckHexBytes("0C");
                sendHexBytes("55");
                //sendHexBytes("55");
 
                sendT0TpduLc("000C000004 CAFEBABE");//write buffer
                receiveAndCheckHexBytes("9000");
                receiveAndCheckHexBytes("9000");
 
 
 
                sendT0TpduLc("00FC000000");//change convention for next ATR
 
                receiveAndCheckHexBytes("9000");
 
 
 
                sendT0TpduLeCheck("000A000004","CAFEBABE");//read buffer
 
                receiveAndCheckHexBytes("9000");
 
 
 
/*              //Reset not supported by the dummy card yet because we use "wait()" in Com tasks...
 
                wait(spy_comOnGoing===1'b0);
 
                wait(spy_guardTime===1'b0);
 
 
 
                startActivation = 1'b0;
 
                startDeactivation = 1'b1;
 
                cyclesPerEtu = 372-1;
 
                wait(1'b0===spy_isActivated);
 
                startDeactivation = 0;
 
                startActivation = 1'b1;
 
 
 
                receiveAndCheckHexBytes("3B 9E 97 80 1F C7 80 31 E0 73 FE 21 1B 66 D0 00 28 24 01 00");
 
                sendT0TpduLeCheck("000A000004","CAFEBABE");//read buffer
 
                receiveAndCheckHexBytes("9000");
 
*/
                tbTestSequenceDone=1'b1;
                tbTestSequenceDone=1'b1;
                #(CLK_PERIOD*372*12);
                #(CLK_PERIOD*372*12);
                if(0===tbErrorCnt) $display("SUCCESS: test sequence completed.");
                if(0===tbErrorCnt) $display("SUCCESS: test sequence completed.");
                $finish;
                $finish;
        end
        end

powered by: WebSVN 2.1.0

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