1
0
mirror of https://github.com/livingcomputermuseum/Darkstar.git synced 2026-04-10 23:29:20 +00:00

Fix for lost word on received Ethernet packets; <-EIData on non-c2 cycles returns last dequeued word from rcv FIFO.

This commit is contained in:
Josh Dersch
2019-03-28 15:49:12 -07:00
parent ea56284992
commit bc5e287a9e
2 changed files with 50 additions and 5 deletions

View File

@@ -1103,6 +1103,8 @@ namespace D.CP
{
memWrite = "{MAR/MDR/MD} ";
}
yBusIsSourceForDestination = true;
}
//

View File

@@ -78,7 +78,7 @@ namespace D.Ethernet
_readerLock = new ReaderWriterLockSlim();
// Start the ethernet reciever poll event, this will run forever.
// Start the ethernet reciever poll event, this will run forever.
_system.Scheduler.Schedule(_receiverPollInterval, ReceiverPollCallback);
Reset();
@@ -111,6 +111,7 @@ namespace D.Ethernet
_outputData = 0;
_outputDataLatched = false;
_fifo.Clear();
_fifoHead = 0;
_inputPacket.Clear();
_crc32.Reset();
}
@@ -208,6 +209,7 @@ namespace D.Ethernet
if (!_enableTx)
{
_fifo.Clear();
_fifoHead = 0;
StopTransmitter();
}
@@ -245,6 +247,7 @@ namespace D.Ethernet
if (!_loopBack)
{
_fifo.Clear();
_fifoHead = 0;
}
_inputPacket.Clear();
@@ -315,6 +318,7 @@ namespace D.Ethernet
// Throw out input data and stop the receiver
_inputPacket.Clear();
_fifo.Clear();
_fifoHead = 0;
_inAttn = false;
_lastRWord = false;
_rxMode_ = true;
@@ -332,7 +336,20 @@ namespace D.Ethernet
//
if (_fifo.Count > 0)
{
value = _fifo.Dequeue();
//ss
// if cycle == 2 we dequeue the next item from the FIFO;
// otherwise the last-dequeued item is returned.
// (See OPT schematic, sheet 6:
// "<-EIData not in Cycle2 is rereading EIData in the case
// of a uCode PageCross.")
//
if (cycle == 2)
{
_fifoHead = _fifo.Dequeue();
}
value = _fifoHead;
if (Log.Enabled) Log.Write(LogComponent.EthernetReceive, " <-EIData: Returning FIFO word 0x{0:x4}. FIFO count is now {1}",
value, _fifo.Count);
@@ -741,6 +758,7 @@ namespace D.Ethernet
}
_fifo.Clear();
_fifoHead = 0;
//
// Skip the preamble state (only used in loopback)
@@ -834,7 +852,14 @@ namespace D.Ethernet
private void UpdateWakeup()
{
//
// See schematic, pg 2; ethernet requests (wakeups) generated by:
// See schematic, pg 2; ethernet requests (wakeups) generated by:
// TxMode & BufIR & Defer' & LastWord' (i.e.transmit on, fifo buffer not full, not deferring, not the last word)
// OR
// Defer & TickElapsed (microcode asked for the transmission to be deferred, and that deferral time has elapsed)
// OR
// RcvMode & BufOR & Purge' (i.e. rcv on, fifo data ready, not purging fifo)
// OR
// Attn (i.e.hardware has a a status to report)
//
bool txWakeup = _enableTx && _fifo.Count < 16 && !_defer && !_lastWord;
bool deferWakeup = _defer & _tickElapsed;
@@ -859,6 +884,7 @@ namespace D.Ethernet
private bool _outputDataLatched;
private ushort _outputData;
private Queue<ushort> _fifo;
private ushort _fifoHead; // Last word dequeued from the FIFO via <-EIData during c2.
// Input data
private Queue<ushort> _inputPacket;
@@ -896,7 +922,19 @@ namespace D.Ethernet
// DiagVideoData : 2
// VideoClock : 1 // Used by LSEP
// DiagLineSync : 0
// EnableRcv : 5
private bool _turnOff_;
private bool _rxEvenLen;
private bool _rxGoodCRC;
private bool _rxOverrun_;
private bool _rxGoodAlign;
private bool _txUnderrun;
private bool _txCollision_;
private bool _rxMode_;
private bool _enableTx;
private bool _lastWord;
private bool _enableRcv;
private bool _localLoop;
private bool _loopBack;
// EOCtl: Bit(etc)
// ----------------------------
@@ -906,7 +944,12 @@ namespace D.Ethernet
private bool _defer;
private bool _rxOverrun_;
// EICtl: Bit(xerox order)
// ------------------------------------
// EnableRcv 15
// TurnOff' 14
// LocalLoop 13
// LoopBack 12
// (See above)
//