How to use the pisa.PisaSemantics function in pisa

To help you get started, we’ve selected a few pisa examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cornell-brg / pymtl / proc / parc_fl / ParcProcFL.py View on Github external
# Accelerator Queue Adapters

    s.xcelreq_q    = OutValRdyQueueAdapter ( s.xcelreq  )
    s.xcelresp_q   = InValRdyQueueAdapter  ( s.xcelresp )

    # Extra Interfaces

    s.go        = InPort   ( 1  )
    s.status    = OutPort  ( 32 )
    s.stats_en  = OutPort  ( 1  )
    s.num_insts = OutPort  ( 32 )

    # Construct the ISA semantics object

    s.isa = PisaSemantics( s.dmem, s.mngr2proc_q, s.proc2mngr_q )

    # We "monkey patch" the mtx/mfx execution functions so that they
    # interact with the above queue adapters

    def execute_mtx( s_, inst ):
      s.xcelreq_q.append( XcelReqMsg().mk_wr( inst.rs, s_.R[inst.rt] ) )
      xcelresp_msg = s.xcelresp_q.popleft()
      s_.PC += 4

    def execute_mfx( s_, inst ):
      s.xcelreq_q.append( XcelReqMsg().mk_rd( inst.rs ) )
      xcelresp_msg = s.xcelresp_q.popleft()
      s_.R[inst.rt] = xcelresp_msg.data
      s_.PC += 4

    s.isa.execute_mtx = execute_mtx