Fill the buffer before blocking on 1-byte read.

Speeds up spike64-2 CheckMisa from 3.49s to 2.92s.

Change-Id: Id4d4042b043f560ef90d58777d99cdcc41053b18
Signed-off-by: Tim Newsome <tim@sifive.com>
This commit is contained in:
Tim Newsome 2021-05-13 17:18:38 -07:00
parent 726c06ca3d
commit 6f0c6f23ce
1 changed files with 4 additions and 0 deletions

View File

@ -181,6 +181,10 @@ static int remote_bitbang_sample(void)
static bb_value_t remote_bitbang_read_sample(void)
{
if (remote_bitbang_start == remote_bitbang_end) {
if (remote_bitbang_fill_buf() != ERROR_OK)
return ERROR_FAIL;
}
if (remote_bitbang_start != remote_bitbang_end) {
int c = remote_bitbang_buf[remote_bitbang_start];
remote_bitbang_start =