Line 1... |
Line 1... |
/*
|
/*
|
Author: Sebastien Riou (acapola)
|
Author: Sebastien Riou (acapola)
|
Creation date: 21:16:10 08/29/2010
|
Creation date: 21:16:10 08/29/2010
|
|
|
$LastChangedDate: 2011-01-29 13:16:17 +0100 (Sat, 29 Jan 2011) $
|
$LastChangedDate: 2011-01-29 17:13:49 +0100 (Sat, 29 Jan 2011) $
|
$LastChangedBy: acapola $
|
$LastChangedBy: acapola $
|
$LastChangedRevision: 11 $
|
$LastChangedRevision: 12 $
|
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/sources/TxCore.v $
|
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/sources/TxCore.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 42... |
Line 42... |
)
|
)
|
(
|
(
|
output wire comClk,
|
output wire comClk,
|
output wire serialOut,
|
output wire serialOut,
|
output wire run,
|
output wire run,
|
|
output reg endOfTx,
|
output wire full,
|
output wire full,
|
output wire stopBits, //1 during stop bits
|
output wire stopBits, //1 during stop bits
|
input wire [7:0] dataIn,
|
input wire [7:0] dataIn,
|
input wire [DIVIDER_WIDTH-1:0] clkPerCycle,
|
input wire [DIVIDER_WIDTH-1:0] clkPerCycle,
|
input wire [CLOCK_PER_BIT_WIDTH-1:0] clocksPerBit,
|
input wire [CLOCK_PER_BIT_WIDTH-1:0] clocksPerBit,
|
Line 141... |
Line 142... |
|
|
always @(posedge clk, negedge nReset) begin
|
always @(posedge clk, negedge nReset) begin
|
if(~nReset) begin
|
if(~nReset) begin
|
nextState <= #1 IDLE_STATE;
|
nextState <= #1 IDLE_STATE;
|
bitCounter <= #1 0;
|
bitCounter <= #1 0;
|
|
endOfTx <= #1 1'b0;
|
end else begin
|
end else begin
|
case(nextState)
|
case(nextState)
|
IDLE_STATE: begin
|
IDLE_STATE: begin
|
if(loadDataIn) begin
|
if(loadDataIn) begin
|
dataBuffer <= #1 dataIn;
|
dataBuffer <= #1 dataIn;
|
Line 176... |
Line 178... |
SEND_STOP1_STATE: begin
|
SEND_STOP1_STATE: begin
|
if(bitClocksCounterMatch)
|
if(bitClocksCounterMatch)
|
nextState <= #1 SEND_STOP2_STATE;
|
nextState <= #1 SEND_STOP2_STATE;
|
end
|
end
|
SEND_STOP2_STATE: begin
|
SEND_STOP2_STATE: begin
|
/* if(bitClocksCounter[1:0]==2'b10)
|
if(bitClocksCounterEarlyMatch)
|
nextState <= #1 SEND_STOP2_STATE2;
|
endOfTx <= #1 1'b1;
|
end
|
if(bitClocksCounterMatch) begin
|
SEND_STOP2_STATE2: begin*/
|
|
if(bitClocksCounterMatch)
|
|
nextState <= #1 IDLE_STATE;
|
nextState <= #1 IDLE_STATE;
|
|
endOfTx <= #1 1'b0;
|
|
end
|
end
|
end
|
default: nextState <= #1 IDLE_STATE;
|
default: nextState <= #1 IDLE_STATE;
|
endcase
|
endcase
|
end
|
end
|
|
|