From 4148f2bed3bdb4dccdb80f561a209fd8a1140d32 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 2 Aug 2018 07:36:29 +0100 Subject: [PATCH] fix dedicated outputs, hard-code enable line to 1 --- src/bsv/actual_pinmux.py | 6 ++++++ src/bsv/pinmux_generator.py | 1 + 2 files changed, 7 insertions(+) diff --git a/src/bsv/actual_pinmux.py b/src/bsv/actual_pinmux.py index 7156fd1..e7f83e3 100644 --- a/src/bsv/actual_pinmux.py +++ b/src/bsv/actual_pinmux.py @@ -55,6 +55,10 @@ def fmt(ifaces, cells, idx, suffix=None): multiple pads be switched simutaneously to outputs by setting the GPIO direction rather than having them set arbitrarily by changing the muxer registers. + + The exception to this rule is when the muxer width is 1 + (i.e. it is a dedicated line). Then, a "1" is outputted + and the pin is PERMANENTly enabled as an output. """ idx += 1 if idx < len(cells): @@ -69,6 +73,8 @@ def fmt(ifaces, cells, idx, suffix=None): if x == 'input': return 'val0' # inputs don't get passed through to the out mux if suffix == '_outen' and x == 'out': + if len(cells) == 2: + return "val1" return "wr%s%s" % (cells[1], suffix or '') # USE GPIO FOR SELECTION if x == 'out': # sigh hack, should be using interface_decl suffix = '' diff --git a/src/bsv/pinmux_generator.py b/src/bsv/pinmux_generator.py index 64ab885..9890f3f 100644 --- a/src/bsv/pinmux_generator.py +++ b/src/bsv/pinmux_generator.py @@ -294,6 +294,7 @@ def write_pmp(pmp, p, ifaces, iocells): bsv_file.write(''' /*====== This where the muxing starts for each io-cell======*/ Wire#(Bit#(1)) val0<-mkDWire(0); // need a zero + Wire#(Bit#(1)) val1<-mkDWire(1); // need a one ''') bsv_file.write(p.pinmux) bsv_file.write(''' -- 2.30.2