diff options
author | Yunsup Lee <yunsup@cs.berkeley.edu> | 2010-09-08 14:16:13 -0700 |
---|---|---|
committer | Yunsup Lee <yunsup@cs.berkeley.edu> | 2010-09-08 14:16:13 -0700 |
commit | 3af5e6b1a55efd9e5a0d21258c23575353d33719 (patch) | |
tree | b5e226a7e8d87df9a5162c53c13a4f81dff4a41f | |
parent | c82197c5930d4bf103fe80a7ac877e22b22c4842 (diff) | |
download | riscv-isa-sim-3af5e6b1a55efd9e5a0d21258c23575353d33719.zip riscv-isa-sim-3af5e6b1a55efd9e5a0d21258c23575353d33719.tar.gz riscv-isa-sim-3af5e6b1a55efd9e5a0d21258c23575353d33719.tar.bz2 |
[sim] change applink for tohost/fromhost
-rw-r--r-- | riscv/applink.cc | 10 | ||||
-rw-r--r-- | riscv/sim.cc | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/riscv/applink.cc b/riscv/applink.cc index d8fddad..6592438 100644 --- a/riscv/applink.cc +++ b/riscv/applink.cc @@ -53,6 +53,16 @@ void appserver_link_t::wait_for_start() while(wait_for_packet() != APP_CMD_START); } +void appserver_link_t::wait_for_tohost() +{ + while(wait_for_packet() != APP_CMD_READ_CONTROL_REG); +} + +void appserver_link_t::wait_for_fromhost() +{ + while(wait_for_packet() != APP_CMD_WRITE_CONTROL_REG); +} + void appserver_link_t::send_packet(packet* p) { while(1) try diff --git a/riscv/sim.cc b/riscv/sim.cc index 06a9cba..2bc1775 100644 --- a/riscv/sim.cc +++ b/riscv/sim.cc @@ -27,12 +27,12 @@ void sim_t::set_tohost(reg_t val) { fromhost = 0; tohost = val; + applink->wait_for_tohost(); } reg_t sim_t::get_fromhost() { - while(fromhost == 0) - applink->wait_for_packet(); + applink->wait_for_fromhost(); return fromhost; } |