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

Subversion Repositories iso7816_3_master

[/] [iso7816_3_master/] [trunk/] [sources/] [Iso7816_3_Master.v] - Diff between revs 17 and 18

Show entire file | Details | Blame | View Log

Rev 17 Rev 18
Line 1... Line 1...
/*
/*
Author: Sebastien Riou (acapola)
Author: Sebastien Riou (acapola)
Creation date: 17:16:40 01/09/2011
Creation date: 17:16:40 01/09/2011
 
 
$LastChangedDate: 2011-02-18 15:23:07 +0100 (Fri, 18 Feb 2011) $
$LastChangedDate: 2011-03-07 14:17:52 +0100 (Mon, 07 Mar 2011) $
$LastChangedBy: acapola $
$LastChangedBy: acapola $
$LastChangedRevision: 17 $
$LastChangedRevision: 18 $
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/sources/Iso7816_3_Master.v $
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/sources/Iso7816_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 48... Line 48...
         output wire tsError,//high if TS character is wrong
         output wire tsError,//high if TS character is wrong
         output wire tsReceived,
         output wire tsReceived,
         output wire atrIsEarly,//high if TS received before 400 cycles after reset release
         output wire atrIsEarly,//high if TS received before 400 cycles after reset release
         output wire atrIsLate,//high if TS is still not received after 40000 cycles after reset release
         output wire atrIsLate,//high if TS is still not received after 40000 cycles after reset release
         //ISO7816 signals
         //ISO7816 signals
    inout wire isoSio,
    //inout wire isoSio,//not synthesisable on FPGA :-S
 
         output wire isTx,
 
         input wire isoSioIn,
 
         output wire isoSioOut,
         output wire isoClk,
         output wire isoClk,
         output reg isoReset,
         output reg isoReset,
         output reg isoVdd
         output reg isoVdd
    );
    );
 
 
wire txRun,txPending, rxRun, rxStartBit, isTx, overrunErrorFlag, frameErrorFlag, bufferFull;
wire txRun,txPending, rxRun, rxStartBit, overrunErrorFlag, frameErrorFlag, bufferFull;
assign {txRun, txPending, rxRun, rxStartBit, isTx, overrunErrorFlag, frameErrorFlag, bufferFull} = statusOut;
assign {txRun, txPending, rxRun, rxStartBit, isTx, overrunErrorFlag, frameErrorFlag, bufferFull} = statusOut;
 
 
wire serialOut;
//wire serialOut;
assign isoSio = isTx ? serialOut : 1'bz;
//not synthesisable on FPGA :-S
pullup(isoSio);
//assign isoSio = isTx ? serialOut : 1'bz;
 
//pullup(isoSio);
wire comClk;
wire comClk;
 
 
wire stopBit2=1'b1;//0: 1 stop bit, 1: 2 stop bits 
wire stopBit2=1'b1;//0: 1 stop bit, 1: 2 stop bits 
wire msbFirst = useIndirectConvention;//if 1, bits order is: startBit, b7, b6, b5...b0, parity
wire msbFirst = useIndirectConvention;//if 1, bits order is: startBit, b7, b6, b5...b0, parity
wire oddParity = 1'b0;//if 1, parity bit is such that data+parity have an odd number of 1
wire oddParity = 1'b0;//if 1, parity bit is such that data+parity have an odd number of 1
Line 90... Line 94...
      .msbFirst(msbFirst),
      .msbFirst(msbFirst),
           .dataOut(uart_dataOut),
           .dataOut(uart_dataOut),
                .nCsDataOut(nCsDataOut),
                .nCsDataOut(nCsDataOut),
                .statusOut(statusOut),
                .statusOut(statusOut),
                .nCsStatusOut(nCsStatusOut),
                .nCsStatusOut(nCsStatusOut),
                .serialIn(isoSio),
                .serialIn(isoSioIn),
                .serialOut(serialOut),
                .serialOut(isoSioOut),
                .comClk(comClk)
                .comClk(comClk)
        );
        );
 
 
        reg isoClkEn;
        reg isoClkEn;
        assign isoClk = isoClkEn ? comClk : 1'b0;
        assign isoClk = isoClkEn ? comClk : 1'b0;
Line 124... Line 128...
                                        8'h3B: ts<=dataOut;
                                        8'h3B: ts<=dataOut;
                                        8'h03: ts<=8'h3F;//03 is 3F written LSB first and complemented
                                        8'h03: ts<=8'h3F;//03 is 3F written LSB first and complemented
                                        default: ts<=dataOut;
                                        default: ts<=dataOut;
                                endcase
                                endcase
                        end
                        end
                        resetCnt<=resetCnt+1;
                        resetCnt<=resetCnt+1'b1;
                end
                end
                if(startDeactivation) begin
                if(startDeactivation) begin
                        isoVdd <= 1'b0;
                        isoVdd <= 1'b0;
                        isoClkEn <= 1'b0;
                        isoClkEn <= 1'b0;
                        isoReset <= 1'b0;
                        isoReset <= 1'b0;
Line 142... Line 146...
                        isoClkEn <= 1'b1;
                        isoClkEn <= 1'b1;
                        if(16'h100 == resetCnt) begin
                        if(16'h100 == resetCnt) begin
                                isActivated <=1'b1;
                                isActivated <=1'b1;
                                isoReset <=1'b1;
                                isoReset <=1'b1;
                        end else
                        end else
                                resetCnt<=resetCnt + 1;
                                resetCnt<=resetCnt + 1'b1;
                end else begin
                end else begin
                        resetCnt<=16'b0;
                        resetCnt<=16'b0;
                end
                end
        end
        end
end
end

powered by: WebSVN 2.1.0

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