From 81e311b503cee4d9edcf6f9ec7eb8f1a095d0505 Mon Sep 17 00:00:00 2001 From: Staf Verhaegen Date: Fri, 6 Dec 2019 20:06:49 +0100 Subject: [PATCH] Simplify signal generation for TAP wishbone interfaces. --- c4m/nmigen/jtag/tap.py | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/c4m/nmigen/jtag/tap.py b/c4m/nmigen/jtag/tap.py index 333105d..a723ab2 100755 --- a/c4m/nmigen/jtag/tap.py +++ b/c4m/nmigen/jtag/tap.py @@ -309,11 +309,6 @@ class TAP(Elaboratable): with m.FSM(domain=domain) as fsm: with m.State("IDLE"): - m.d.comb += [ - wb.cyc.eq(0), - wb.stb.eq(0), - wb.we.eq(0), - ] with m.If(sr_addr.oe): # WBADDR code m.d[domain] += wb.adr.eq(sr_addr.o) m.next = "READ" @@ -325,37 +320,23 @@ class TAP(Elaboratable): m.d[domain] += wb.dat_w.eq(sr_data.o) m.next = "WRITEREAD" with m.State("READ"): - m.d.comb += [ - wb.cyc.eq(1), - wb.stb.eq(1), - wb.we.eq(0), - ] with m.If(~wb.stall): m.next = "READACK" with m.State("READACK"): - m.d.comb += [ - wb.cyc.eq(1), - wb.stb.eq(0), - wb.we.eq(0), - ] with m.If(wb.ack): # Store read data in sr_data.i and keep it there til next read m.d[domain] += sr_data.i.eq(wb.dat_r) m.next = "IDLE" with m.State("WRITEREAD"): - m.d.comb += [ - wb.cyc.eq(1), - wb.stb.eq(1), - wb.we.eq(1), - ] with m.If(~wb.stall): m.next = "WRITEREADACK" with m.State("WRITEREADACK"): - m.d.comb += [ - wb.cyc.eq(1), - wb.stb.eq(0), - wb.we.eq(0), - ] with m.If(wb.ack): m.d[domain] += wb.adr.eq(wb.adr + 1) m.next = "READ" + + m.d.comb += [ + wb.cyc.eq(~fsm.ongoing("IDLE")), + wb.stb.eq(fsm.ongoing("READ") | fsm.ongoing("WRITEREAD")), + wb.we.eq(fsm.ongoing("WRITEREAD")), + ] -- 2.30.2