drtio: fixes

This commit is contained in:
Sebastien Bourdeauducq 2016-10-26 22:03:44 +08:00
parent 45621934fd
commit 929a7650a8
2 changed files with 8 additions and 8 deletions

View File

@ -48,17 +48,18 @@ class IOT(Module):
# FIFO write # FIFO write
self.comb += fifo.we.eq(rt_packets.write_stb self.comb += fifo.we.eq(rt_packets.write_stb
& (rt_packets.write_channel == n)) & (rt_packets.write_channel == n))
self.sync += \ self.sync += [
If(rt_packets.write_overflow_ack,
rt_packets.write_overflow.eq(0)),
If(rt_packets.write_underflow_ack,
rt_packets.write_underflow.eq(0)),
If(fifo.we, If(fifo.we,
If(rt_packets.write_overflow_ack,
rt_packets.write_overflow.eq(0)),
If(~fifo.writable, rt_packets.write_overflow.eq(1)), If(~fifo.writable, rt_packets.write_overflow.eq(1)),
If(rt_packets.write_underflow_ack,
rt_packets.write_underflow.eq(0)),
If(rt_packets.write_timestamp[max_fine_ts_width:] < (tsc + 4), If(rt_packets.write_timestamp[max_fine_ts_width:] < (tsc + 4),
rt_packets.write_underflow.eq(1) rt_packets.write_underflow.eq(1)
) )
) )
]
if data_width: if data_width:
self.comb += fifo_in.data.eq(rt_packets.write_data) self.comb += fifo_in.data.eq(rt_packets.write_data)
if address_width: if address_width:

View File

@ -48,7 +48,7 @@ class RTController(Module):
self.comb += [ self.comb += [
rt_packets.tsc_value.eq( rt_packets.tsc_value.eq(
self.counter.value_rtio + tsc_correction), self.counter.value_rtio + tsc_correction),
self.kcsrs.set_time.r.eq(rt_packets.set_time_stb) self.kcsrs.set_time.w.eq(rt_packets.set_time_stb)
] ]
self.sync += [ self.sync += [
If(rt_packets.set_time_ack, rt_packets.set_time_stb.eq(0)), If(rt_packets.set_time_ack, rt_packets.set_time_stb.eq(0)),
@ -98,8 +98,7 @@ class RTController(Module):
cond_sequence_error = self.kcsrs.o_timestamp.storage < last_timestamps.dat_r cond_sequence_error = self.kcsrs.o_timestamp.storage < last_timestamps.dat_r
cond_underflow = ((self.kcsrs.o_timestamp.storage[fine_ts_width:] cond_underflow = ((self.kcsrs.o_timestamp.storage[fine_ts_width:]
- self.kcsrs.underflow_margin.storage[fine_ts_width:]) < self.counter.value_sys) - self.kcsrs.underflow_margin.storage[fine_ts_width:]) < self.counter.value_sys)
cond_fifo_emptied = ((last_timestamps.dat_r[fine_ts_width:] cond_fifo_emptied = ((last_timestamps.dat_r[fine_ts_width:] < self.counter.value_sys)
< self.counter.value_sys - self.kcsrs.underflow_margin.storage[fine_ts_width:])
& (last_timestamps.dat_r != 0)) & (last_timestamps.dat_r != 0))
fsm.act("IDLE", fsm.act("IDLE",