logic_analyzer: add and use clock_freq property

This commit is contained in:
Fischer Moseley 2024-10-12 14:37:14 -07:00
parent 3fab791329
commit 599384ecc2
4 changed files with 10 additions and 2 deletions

View File

@ -150,6 +150,10 @@ class EthernetInterface(Elaboratable):
"""
return [io[2] for io in self._phy_io]
@property
def clock_freq(self):
return self._clk_freq
def _binarize_ip_addr(self, ip_addr):
octets = [bin(int(o))[2:].zfill(8) for o in ip_addr.split(".")]
return int("".join(octets), 2)

View File

@ -292,7 +292,7 @@ class LogicAnalyzerCore(MantaCore):
self._fsm.stop_capture()
print(" -> Setting triggers...")
self._trig_blk.set_triggers(self.triggers)
self._trig_blk.set_triggers(self._triggers)
print(" -> Setting trigger mode...")
self._fsm.write_register("trigger_mode", self._trigger_mode)

View File

@ -104,7 +104,7 @@ class LogicAnalyzerCapture:
"""
# Compute the timescale from the frequency of the provided clock
half_period = 1 / (2 * self._interface._clock_freq)
half_period = 1 / (2 * self._interface.clock_freq)
exponent = math.floor(math.log10(half_period))
exponent_eng = (exponent // 3) * 3

View File

@ -189,6 +189,10 @@ class UARTInterface(Elaboratable):
"""
return [self.rx, self.tx]
@property
def clock_freq(self):
return self._clock_freq
def read(self, addrs):
"""
Read the data stored in a set of address on Manta's internal memory.