- with m.If(self.command == 3):
- m.d.sync += [
- self.entry_array[index].write.eq(0),
- self.entry_array[index].key_in.eq(self.key_in),
- self.entry_array[index].data_in.eq(self.data_in),
- self.encoder_input[index].eq(self.entry_array[index].match)
- ]
+ with m.Switch(self.command):
+ # Read and Search both read from the CamEntry
+ with m.Case("-1"):
+ m.d.comb += self.entry_array[index].command.eq(1)
+ # Write only to one entry
+ with m.Case("10"):
+ with m.If(self.address == index):
+ m.d.comb += self.entry_array[index].command.eq(2)
+ with m.Else():
+ m.d.comb += self.entry_array[index].command.eq(0)
+ # NA
+ with m.Case():
+ m.d.comb += self.entry_array[index].command.eq(0)
+
+ m.d.comb += [
+ self.entry_array[index].key_in.eq(self.key_in),
+ self.entry_array[index].data_in.eq(self.data_in),
+ self.encoder_input[index].eq(self.entry_array[index].match)
+ ]