Skip to content

Commit

Permalink
mezzanine: tristate split for bitwise inout
Browse files Browse the repository at this point in the history
  • Loading branch information
jordens committed Mar 6, 2023
1 parent 247b68e commit 83bf9be
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions mirny.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,16 @@ def __init__(self, platform):
platform.request("fsen").eq(~regs[1].write[9]),
]

mezz = platform.request("mezz_io")
mezz_io = platform.request("mezz_io")
mezz = []
for i in range(len(mezz_io)):
t = TSTriple()
self.specials += t.get_tristate(mezz_io[i])
mezz.append(t)
self.comb += [
mezz[7].eq(regs[1].write[11]) # Almazny REG_NOE
mezz[7].oe.eq(1),
mezz[7].o.eq(regs[1].write[11]), # Almazny REG_NOE
mezz[2].oe.eq(0), # Almazny PGOOD
]

for i in range(4):
Expand Down Expand Up @@ -355,12 +362,15 @@ def __init__(self, platform):
ext = Record(ext_layout)
self.sr.connect_ext(ext, adr=i + 12, mask=mask)
self.comb += [
mezz[i + 3].eq(ext.cs), # Almazny REG_LATCH
mezz[i + 3].oe.eq(1),
mezz[i + 3].o.eq(~ext.cs), # Almazny REG_LATCH
]
if i == 0:
self.comb += [
mezz[0].eq(ext.sdi), # Almazny SER_MOSI
mezz[1].eq(ext.sck), # Almazny SER_SCK
mezz[0].oe.eq(1),
mezz[0].o.eq(ext.sdi), # Almazny SER_MOSI
mezz[1].oe.eq(1),
mezz[1].o.eq(ext.sck), # Almazny SER_SCK
]

tp = [platform.request("tp", i) for i in range(5)]
Expand Down

0 comments on commit 83bf9be

Please sign in to comment.