From: Yunsup Lee Date: Wed, 8 Sep 2010 21:16:13 +0000 (-0700) Subject: [sim] change applink for tohost/fromhost X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3af5e6b1a55efd9e5a0d21258c23575353d33719;p=riscv-isa-sim.git [sim] change applink for tohost/fromhost --- 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; }