[Oberon] PO2013 - SD Image Tool
Paul Reed
paulreed at paddedcell.com
Sat May 23 09:31:32 CEST 2020
Hi Tomas,
> ...the meaning of data and stat in Send/Rec routines in RS232.Mod?
[In software:]
> ...CONST data = -56; stat = -52;
> ...REPEAT UNTIL SYSTEM.BIT(stat, 1); SYSTEM.PUT(data, x)
> ...REPEAT UNTIL SYSTEM.BIT(stat, 0); SYSTEM.GET(data, x)
[And in hardware (RISC5Top.v)]
> ...(iowadr == 19) ? {30'b0, rdyTx, rdyRx} : // -52
> ...transmitter(..., [.start(startTx),]..., .rdy(rdyTx));
These bits are nothing to do with serial line handshaking, they are just
flags saying whether it is ok to send or receive a byte yet, in other
words whether the previous byte has finished sending, and whether a byte
has been received. They are internal to the RISC5, documented on page 3
of
https://inf.ethz.ch/personal/wirth/FPGA-relatedWork/RISC-Arch.pdf
The rest of the relevant Verilog is:
(RISC5Top.v) ...receiver(..., .done(doneRx), .rdy(rdyRx));
...
assign startTx = wr & ioenb & (iowadr == 2);
assign doneRx = rd & ioenb & (iowadr == 2);
...
(RS232R.v)
assign rdy = stat; ...stat <= (endtick & endbit) ? 1 : (~rst | done) ?
0 : stat;
(RS232T.v)
assign rdy = ~run; ...run <= (~rst | endtick & endbit) ? 0 : start ? 1
: run;
A byte is received bit by bit (endtick) until all the bits have been
received (endbit) and then rdyRx will be set. It is reset when you read
a byte (done).
A byte is sent bit by bit (endtick) until all the bits are sent (endbit)
and then rdyTx will be set. It is reset when you write a byte (start).
Obviously you have to wait for the last byte to be sent before sending
another byte, and you have to wait for a full byte to be received before
reading it. Otherwise you will be sending or receiving partial bytes.
(This is, unless you want to add to the list of Joerg's challenges the
task of writing FIFOs for tx and rx). :)
The Oberon serial routines you are using have no handshaking because
they are designed to work that way. It is assumed that the RISC5 is
fast enough to receive an entire packet of data in a tight loop until it
is finished. If the RISC5 were to go off and do some long routine while
it is supposed to be reading serial data it will simply miss some, so
this is avoided. Take care then, when modifying this code!
HTH,
Paul
More information about the Oberon
mailing list