Line 1... |
Line 1... |
/*
|
/*
|
Author: Sebastien Riou (acapola)
|
Author: Sebastien Riou (acapola)
|
Creation date: 23:57:02 08/31/2010
|
Creation date: 23:57:02 08/31/2010
|
|
|
$LastChangedDate: 2011-01-29 17:13:49 +0100 (Sat, 29 Jan 2011) $
|
$LastChangedDate: 2011-02-13 16:20:10 +0100 (Sun, 13 Feb 2011) $
|
$LastChangedBy: acapola $
|
$LastChangedBy: acapola $
|
$LastChangedRevision: 12 $
|
$LastChangedRevision: 15 $
|
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/sources/Uart.v $
|
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/sources/Uart.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 81... |
Line 81... |
wire txStopBits;
|
wire txStopBits;
|
assign isTx = txRun & ~txStopBits;
|
assign isTx = txRun & ~txStopBits;
|
assign loadDataIn = startTx & ~rxStartBit & (~rxRun | endOfRx);
|
assign loadDataIn = startTx & ~rxStartBit & (~rxRun | endOfRx);
|
|
|
reg [CLOCK_PER_BIT_WIDTH-1:0] safeClocksPerBit;
|
reg [CLOCK_PER_BIT_WIDTH-1:0] safeClocksPerBit;
|
|
reg safeStopBit2;
|
|
reg safeOddParity;
|
|
reg safeMsbFirst;
|
always @(posedge clk, negedge nReset) begin
|
always @(posedge clk, negedge nReset) begin
|
if(~nReset) begin
|
if(~nReset) begin
|
safeClocksPerBit<=clocksPerBit;
|
safeClocksPerBit<=clocksPerBit;
|
|
safeStopBit2<=stopBit2;
|
|
safeOddParity<=oddParity;
|
|
safeMsbFirst<=msbFirst;
|
end else if(endOfRx|endOfTx|~(rxRun|rxStartBit|txRun)) begin
|
end else if(endOfRx|endOfTx|~(rxRun|rxStartBit|txRun)) begin
|
safeClocksPerBit<=clocksPerBit;
|
safeClocksPerBit<=clocksPerBit;
|
|
safeStopBit2<=stopBit2;
|
|
safeOddParity<=oddParity;
|
|
safeMsbFirst<=msbFirst;
|
end
|
end
|
end
|
end
|
|
|
wire stopBit;
|
wire stopBit;
|
// Instantiate the module
|
// Instantiate the module
|
Line 106... |
Line 115... |
.run(rxRun),
|
.run(rxRun),
|
.startBit(rxStartBit),
|
.startBit(rxStartBit),
|
.stopBit(stopBit),
|
.stopBit(stopBit),
|
.clkPerCycle(clkPerCycle),
|
.clkPerCycle(clkPerCycle),
|
.clocksPerBit(safeClocksPerBit),
|
.clocksPerBit(safeClocksPerBit),
|
.stopBit2(stopBit2),
|
.stopBit2(safeStopBit2),
|
.oddParity(oddParity),
|
.oddParity(safeOddParity),
|
.msbFirst(msbFirst),
|
.msbFirst(safeMsbFirst),
|
.ackFlags(ackFlags),
|
.ackFlags(ackFlags),
|
.serialIn(rxSerialIn),
|
.serialIn(rxSerialIn),
|
.comClk(comClk),
|
.comClk(comClk),
|
.clk(clk),
|
.clk(clk),
|
.nReset(nReset)
|
.nReset(nReset)
|
Line 127... |
Line 136... |
.full(txFull),
|
.full(txFull),
|
.stopBits(txStopBits),
|
.stopBits(txStopBits),
|
.dataIn(txData),
|
.dataIn(txData),
|
.clkPerCycle(clkPerCycle),
|
.clkPerCycle(clkPerCycle),
|
.clocksPerBit(safeClocksPerBit),
|
.clocksPerBit(safeClocksPerBit),
|
.stopBit2(stopBit2),
|
.stopBit2(safeStopBit2),
|
.oddParity(oddParity),
|
.oddParity(safeOddParity),
|
.msbFirst(msbFirst),
|
.msbFirst(safeMsbFirst),
|
.loadDataIn(loadDataIn),
|
.loadDataIn(loadDataIn),
|
.comClk(comClk),
|
.comClk(comClk),
|
.clk(clk),
|
.clk(clk),
|
.nReset(nReset)
|
.nReset(nReset)
|
);
|
);
|