Skip to content

Commit

Permalink
Merge pull request #1894 from mdejw/patch-1
Browse files Browse the repository at this point in the history
Send serial data to sim uart only if rx_ready is set.
  • Loading branch information
enjoy-digital authored Feb 22, 2024
2 parents dc229f8 + 0de87ce commit 7f91baa
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions litex/build/sim/core/modules/serial2console/serial2console.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,13 @@ static int serial2console_tick(void *sess, uint64_t time_ps) {
}

*s->rx_valid = 0;
if(s->datalen) {
*s->rx = s->databuf[s->data_start];
s->data_start = (s->data_start + 1) % 2048;
s->datalen--;
*s->rx_valid = 1;
if(*s->rx_ready) {
if(s->datalen) {
*s->rx = s->databuf[s->data_start];
s->data_start = (s->data_start + 1) % 2048;
s->datalen--;
*s->rx_valid = 1;
}
}

return RC_OK;
Expand Down

0 comments on commit 7f91baa

Please sign in to comment.