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 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'infra/arbiter.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()); + } + } + } + }; } -- cgit v1.2.3