sporniket / amaranth_sandbox

A collection of experimentations using the amaranth HDL framework
GNU General Public License v3.0
0 stars 0 forks source link

Association table -- half cell #1

Open sporniket opened 2 years ago

sporniket commented 2 years ago

The principles :

sporniket commented 2 years ago
enum HalfCellMode:
  TAG_FROM_VALUE,
  VALUE_FROM_TAG

enum HiReadLoWrite:
  WRITE,
  READ

class HalfCell(Elaboratable):
  __init__(self, valueShape: Shape, tag:Signal (?), mode:HalfCellMode ):
    self.value = Signal(valueShape)
    self.tag = tag
    self.mode = mode
    self.Matches = Signal(1)
    self.DataOut = mode == TAG_FROM_VALUE ? Signal(tag.shape) : Signal(valueShape)
    self DataIn = mode == VALUE_FROM_TAG ? Signal(tag.shape) : Signal(valueShape)

  ports:
    return [self.DataIn, self.RxW, self.DataOut, self.Matches]