Line 1... |
Line 1... |
`timescale 1ns / 1ps
|
`timescale 1ns / 1ps
|
|
`default_nettype none
|
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
// Company:
|
// Company:
|
// Engineer:
|
// Engineer:
|
//
|
//
|
// Create Date: 17:16:40 01/09/2011
|
// Create Date: 17:16:40 01/09/2011
|
Line 17... |
Line 18... |
// Revision 0.01 - File Created
|
// Revision 0.01 - File Created
|
// Additional Comments:
|
// Additional Comments:
|
//
|
//
|
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
module Iso7816_3_Master(
|
module Iso7816_3_Master(
|
input nReset,
|
input wire nReset,
|
input clk,
|
input wire clk,
|
input [15:0] clkPerCycle,//not supported yet
|
input wire [15:0] clkPerCycle,//not supported yet
|
input startActivation,//Starts activation sequence
|
input wire startActivation,//Starts activation sequence
|
input startDeactivation,//Starts deactivation sequence
|
input wire startDeactivation,//Starts deactivation sequence
|
input [7:0] dataIn,
|
input wire [7:0] dataIn,
|
input nWeDataIn,
|
input wire nWeDataIn,
|
input [12:0] cyclePerEtu,
|
input wire [12:0] cyclePerEtu,
|
output [7:0] dataOut,
|
output wire [7:0] dataOut,
|
input nCsDataOut,
|
input wire nCsDataOut,
|
output [7:0] statusOut,
|
output wire [7:0] statusOut,
|
input nCsStatusOut,
|
input wire nCsStatusOut,
|
output reg isActivated,//set to high by activation sequence, set to low by deactivation sequence
|
output reg isActivated,//set to high by activation sequence, set to low by deactivation sequence
|
output useIndirectConvention,
|
output wire useIndirectConvention,
|
output tsError,//high if TS character is wrong
|
output wire tsError,//high if TS character is wrong
|
output tsReceived,
|
output wire tsReceived,
|
output 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 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 isoSio,
|
inout wire isoSio,
|
output 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, isTx, 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;
|
assign isoSio = isTx ? serialOut : 1'bz;
|
assign isoSio = isTx ? serialOut : 1'bz;
|
pullup(isoSio);
|
pullup(isoSio);
|
wire comClk;
|
wire comClk;
|
|
|
HalfDuplexUartIf uart (
|
HalfDuplexUartIf uart (
|