Skip to content

Commit

Permalink
Merge pull request #7 from Spaqin/almazny_fix
Browse files Browse the repository at this point in the history
Almazny bug fix: pass MOSI for all channels
  • Loading branch information
jordens authored Aug 20, 2024
2 parents 83bf9be + cb92590 commit e6946d0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mirny.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def connect(self, bus, adr, mask):
)
]

def connect_ext(self, ext, adr, mask):
def connect_ext(self, ext, adr, mask, sdi_passthrough=False):
adr &= mask
self._check_intersection(adr, mask)
self._slaves.append((ext, adr, mask))
Expand All @@ -146,12 +146,16 @@ def connect_ext(self, ext, adr, mask):
stb.ce.eq(self.bus.re),
# don't glitch with &stb.o
ext.sck.eq(self.ext.sck),
ext.sdi.eq(self.ext.sdi & stb.o),
ext.cs.eq(stb.o),
If(stb.o,
self.ext.sdo.eq(ext.sdo),
),
]
# Almazny shares one SDI with 4 devices, it cannot be masked by stb
if sdi_passthrough:
self.comb += ext.sdi.eq(self.ext.sdi)
else:
self.comb += ext.sdi.eq(self.ext.sdi & stb.o),


def intersection(a, b):
Expand Down Expand Up @@ -360,7 +364,7 @@ def __init__(self, platform):
]

ext = Record(ext_layout)
self.sr.connect_ext(ext, adr=i + 12, mask=mask)
self.sr.connect_ext(ext, adr=i + 12, mask=mask, sdi_passthrough=True)
self.comb += [
mezz[i + 3].oe.eq(1),
mezz[i + 3].o.eq(~ext.cs), # Almazny REG_LATCH
Expand Down

0 comments on commit e6946d0

Please sign in to comment.