From 636d4efe8174c6e75b17cfa605441b5f6ef50694 Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 1 Nov 2016 06:28:43 +0000 Subject: [PATCH] gateware: rewrite mailbox to use bits_for. --- artiq/gateware/amp/mailbox.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artiq/gateware/amp/mailbox.py b/artiq/gateware/amp/mailbox.py index 4c93557df..7c60056d1 100644 --- a/artiq/gateware/amp/mailbox.py +++ b/artiq/gateware/amp/mailbox.py @@ -12,10 +12,10 @@ class Mailbox(Module): values = Array([Signal(32) for _ in range(size)]) for i in self.i1, self.i2: self.sync += [ - i.dat_r.eq(values[i.adr & 0xff]), + i.dat_r.eq(values[i.adr[:bits_for(size-1)]]), i.ack.eq(0), If(i.cyc & i.stb & ~i.ack, i.ack.eq(1), - If(i.we, values[i.adr & 0xff].eq(i.dat_w)) + If(i.we, values[i.adr[:bits_for(size-1)]].eq(i.dat_w)) ) ]