From c25e80b08f473fce0fdf11f2445f5b3f3b2bf342 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Sat, 15 Oct 2022 13:59:46 -0700 Subject: Move shared_bus into arbiter --- infra/arbiter.h | 14 ++++++++++++++ infra/bus.h | 22 ---------------------- 2 files changed, 14 insertions(+), 22 deletions(-) delete mode 100644 infra/bus.h diff --git a/infra/arbiter.h b/infra/arbiter.h index 74e37be..79a9920 100644 --- a/infra/arbiter.h +++ b/infra/arbiter.h @@ -38,4 +38,18 @@ namespace infra { initial = 0; } }; + + template struct shared_bus : public sim { + std::array, peers> peerp; + port *outp = nullptr; + + void clock() { + for (unsigned int i = 0; i < peers; ++i) { + if (peerp[i].can_read()) { + assert(outp->can_write()); + outp->write(peerp[i].read()); + } + } + } + }; } diff --git a/infra/bus.h b/infra/bus.h deleted file mode 100644 index e986174..0000000 --- a/infra/bus.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include -#include - -#include "infra/sim.h" - -namespace infra { - template struct shared_bus : public sim { - std::array, peers> peerp; - port *outp = nullptr; - - void clock() { - for (unsigned int i = 0; i < peers; ++i) { - if (peerp[i].can_read()) { - assert(outp->can_write()); - outp->write(peerp[i].read()); - } - } - } - }; -} -- cgit v1.2.3