OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [src/] [OrpsocAccess.cpp] - Diff between revs 439 and 462

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 439 Rev 462
Line 70... Line 70...
 
 
//! Access for the ex_freeze signal
//! Access for the ex_freeze signal
 
 
//! @return  The value of the or1200_ctrl.ex_freeze signal
//! @return  The value of the or1200_ctrl.ex_freeze signal
 
 
bool
bool OrpsocAccess::getExFreeze()
OrpsocAccess::getExFreeze ()
 
{
{
  return  or1200_ctrl->ex_freeze;
  return  or1200_ctrl->ex_freeze;
 
 
}       // getExFreeze ()
}       // getExFreeze ()
 
 
//! Access for the wb_freeze signal
//! Access for the wb_freeze signal
 
 
//! @return  The value of the or1200_ctrl.wb_freeze signal
//! @return  The value of the or1200_ctrl.wb_freeze signal
 
 
bool
bool OrpsocAccess::getWbFreeze()
OrpsocAccess::getWbFreeze ()
 
{
{
  return  or1200_ctrl->wb_freeze;
  return  or1200_ctrl->wb_freeze;
 
 
}       // getWbFreeze ()
}       // getWbFreeze ()
 
 
//! Access for the except_flushpipe signal
//! Access for the except_flushpipe signal
 
 
//! @return  The value of the or1200_except.except_flushpipe signal
//! @return  The value of the or1200_except.except_flushpipe signal
 
 
bool
bool OrpsocAccess::getExceptFlushpipe()
OrpsocAccess::getExceptFlushpipe ()
 
{
{
  return  or1200_except->except_flushpipe;
  return  or1200_except->except_flushpipe;
 
 
}       // getExceptFlushpipe ()
}       // getExceptFlushpipe ()
 
 
//! Access for the ex_dslot signal
//! Access for the ex_dslot signal
 
 
//! @return  The value of the or1200_except.ex_dslot signalfac
//! @return  The value of the or1200_except.ex_dslot signalfac
 
 
bool
bool OrpsocAccess::getExDslot()
OrpsocAccess::getExDslot ()
 
{
{
  return  or1200_except->ex_dslot;
  return  or1200_except->ex_dslot;
 
 
}       // getExDslot ()
}       // getExDslot ()
 
 
//! Access for the except_type value
//! Access for the except_type value
 
 
//! @return  The value of the or1200_except.except_type register
//! @return  The value of the or1200_except.except_type register
 
 
uint32_t
uint32_t OrpsocAccess::getExceptType()
OrpsocAccess::getExceptType ()
 
{
{
  return  (or1200_except->get_except_type) ();
  return  (or1200_except->get_except_type) ();
 
 
}       // getExceptType ()
}       // getExceptType ()
 
 
 
 
//! Access for the id_pc register
//! Access for the id_pc register
 
 
//! @return  The value of the or1200_except.id_pc register
//! @return  The value of the or1200_except.id_pc register
 
 
uint32_t
uint32_t OrpsocAccess::getIdPC()
OrpsocAccess::getIdPC ()
 
{
{
  return  (or1200_except->get_id_pc) ();
  return  (or1200_except->get_id_pc) ();
 
 
}       // getIdPC ()
}       // getIdPC ()
 
 
//! Access for the ex_pc register
//! Access for the ex_pc register
 
 
//! @return  The value of the or1200_except.id_ex register
//! @return  The value of the or1200_except.id_ex register
 
 
uint32_t
uint32_t OrpsocAccess::getExPC()
OrpsocAccess::getExPC ()
 
{
{
  return  (or1200_except->get_ex_pc) ();
  return  (or1200_except->get_ex_pc) ();
 
 
}       // getExPC ()
}       // getExPC ()
 
 
//! Access for the wb_pc register
//! Access for the wb_pc register
 
 
//! @return  The value of the or1200_except.wb_pc register
//! @return  The value of the or1200_except.wb_pc register
 
 
uint32_t
uint32_t OrpsocAccess::getWbPC()
OrpsocAccess::getWbPC ()
 
{
{
  return  (or1200_except->get_wb_pc) ();
  return  (or1200_except->get_wb_pc) ();
 
 
}       // getWbPC ()
}       // getWbPC ()
 
 
//! Access for the id_insn register
//! Access for the id_insn register
 
 
//! @return  The value of the or1200_ctrl.wb_insn register
//! @return  The value of the or1200_ctrl.wb_insn register
 
 
uint32_t
uint32_t OrpsocAccess::getIdInsn()
OrpsocAccess::getIdInsn ()
 
{
{
  return  (or1200_ctrl->get_id_insn) ();
  return  (or1200_ctrl->get_id_insn) ();
 
 
}       // getIdInsn ()
}       // getIdInsn ()
 
 
//! Access for the ex_insn register
//! Access for the ex_insn register
 
 
//! @return  The value of the or1200_ctrl.ex_insn register
//! @return  The value of the or1200_ctrl.ex_insn register
 
 
uint32_t
uint32_t OrpsocAccess::getExInsn()
OrpsocAccess::getExInsn ()
 
{
{
  return  (or1200_ctrl->get_ex_insn) ();
  return  (or1200_ctrl->get_ex_insn) ();
 
 
}       // getExInsn ()
}       // getExInsn ()
 
 
 
 
//! Access for the wb_insn register
//! Access for the wb_insn register
 
 
//! @return  The value of the or1200_ctrl.wb_insn register
//! @return  The value of the or1200_ctrl.wb_insn register
 
 
uint32_t
uint32_t OrpsocAccess::getWbInsn()
OrpsocAccess::getWbInsn ()
 
{
{
  return  (or1200_ctrl->get_wb_insn) ();
  return  (or1200_ctrl->get_wb_insn) ();
 
 
}       // getWbInsn ()
}       // getWbInsn ()
 
 
//! Access the Wishbone SRAM memory
//! Access the Wishbone SRAM memory
 
 
//! @return  The value of the 32-bit memory word at addr
//! @return  The value of the 32-bit memory word at addr
 
 
uint32_t
uint32_t OrpsocAccess::get_mem32(uint32_t addr)
OrpsocAccess::get_mem32 (uint32_t addr)
 
{
{
  return  (wishbone_ram->get_mem) (addr/4);
        return (wishbone_ram->get_mem32) (addr / 4);
 
 
}       // get_mem32 ()
}       // get_mem32 ()
 
 
 
 
//! Access a byte from the Wishbone SRAM memory
//! Access a byte from the Wishbone SRAM memory
 
 
//! @return  The value of the memory byte at addr
//! @return  The value of the memory byte at addr
 
 
uint8_t
uint8_t OrpsocAccess::get_mem8(uint32_t addr)
OrpsocAccess::get_mem8 (uint32_t addr)
 
{
{
 
 
  uint32_t word;
  uint32_t word;
  static uint32_t cached_word;
  static uint32_t cached_word;
  static uint32_t cached_word_addr = 0xffffffff;
  static uint32_t cached_word_addr = 0xffffffff;
  int sel = addr & 0x3; // Remember which byte we want
  int sel = addr & 0x3; // Remember which byte we want
  addr = addr / 4;
  addr = addr / 4;
  if (addr != cached_word_addr)
        if (addr != cached_word_addr) {
    {
 
      cached_word_addr = addr;
      cached_word_addr = addr;
      // Convert address to word number here
      // Convert address to word number here
      word = (wishbone_ram->get_mem) (addr);
                word = (wishbone_ram->get_mem8) (addr);
      cached_word = word;
      cached_word = word;
    }
        } else
  else
 
    word = cached_word;
    word = cached_word;
 
 
  switch(sel)
        switch (sel) {
    {
 
      /* Big endian word expected */
      /* Big endian word expected */
    case 0:
    case 0:
      return ((word >> 24) & 0xff);
      return ((word >> 24) & 0xff);
      break;
      break;
    case 1:
    case 1:
Line 245... Line 226...
      return 0;
      return 0;
    }
    }
 
 
}       // get_mem8 ()
}       // get_mem8 ()
 
 
 
 
//! Write value to the Wishbone SRAM memory
//! Write value to the Wishbone SRAM memory
 
 
void
void OrpsocAccess::set_mem32(uint32_t addr, uint32_t data)
OrpsocAccess::set_mem32 (uint32_t addr, uint32_t data)
 
{
{
  (wishbone_ram->set_mem) (addr/4, data);
        (wishbone_ram->set_mem32) (addr / 4, data);
 
 
}       // set_mem32 ()
}       // set_mem32 ()
 
 
//! Trigger the $readmemh() system call
//! Trigger the $readmemh() system call
 
 
void
void OrpsocAccess::do_ram_readmemh(void)
OrpsocAccess::do_ram_readmemh (void)
 
{
{
  (wishbone_ram->do_readmemh) ();
  (wishbone_ram->do_readmemh) ();
 
 
}       // do_ram_readmemh ()
}       // do_ram_readmemh ()
 
 
Line 272... Line 250...
 
 
//! @param[in] regNum  The GPR whose value is wanted
//! @param[in] regNum  The GPR whose value is wanted
 
 
//! @return            The value of the GPR
//! @return            The value of the GPR
 
 
uint32_t
uint32_t OrpsocAccess::getGpr(uint32_t regNum)
OrpsocAccess::getGpr (uint32_t  regNum)
 
{
{
  return  (rf_a->get_gpr) (regNum);
  return  (rf_a->get_gpr) (regNum);
 
 
}       // getGpr ()
}       // getGpr ()
 
 
 
//! Access for the OR1200 GPRs
 
 
 
//! These are extracted from memory using the Verilog function
 
 
 
//! @param[in] regNum  The GPR whose value is wanted
 
//! @param[in] value   The value of GPR to write
 
 
 
void OrpsocAccess::setGpr(uint32_t regNum, uint32_t value)
 
{
 
        (rf_a->set_gpr) (regNum, value);
 
 
 
}                               // getGpr ()
 
 
//! Access for the sr register
//! Access for the sr register
 
 
//! @return  The value of the or1200_sprs.sr register
//! @return  The value of the or1200_sprs.sr register
 
 
uint32_t
uint32_t OrpsocAccess::getSprSr()
OrpsocAccess::getSprSr ()
 
{
{
  return  (or1200_sprs->get_sr) ();
  return  (or1200_sprs->get_sr) ();
 
 
}       // getSprSr ()
}       // getSprSr ()
 
 
//! Access for the epcr register
//! Access for the epcr register
 
 
//! @return  The value of the or1200_sprs.epcr register
//! @return  The value of the or1200_sprs.epcr register
 
 
uint32_t
uint32_t OrpsocAccess::getSprEpcr()
OrpsocAccess::getSprEpcr ()
 
{
{
  return  (or1200_sprs->get_epcr) ();
  return  (or1200_sprs->get_epcr) ();
 
 
}       // getSprEpcr ()
}       // getSprEpcr ()
 
 
//! Access for the eear register
//! Access for the eear register
 
 
//! @return  The value of the or1200_sprs.eear register
//! @return  The value of the or1200_sprs.eear register
 
 
uint32_t
uint32_t OrpsocAccess::getSprEear()
OrpsocAccess::getSprEear ()
 
{
{
  return  (or1200_sprs->get_eear) ();
  return  (or1200_sprs->get_eear) ();
 
 
}       // getSprEear ()
}       // getSprEear ()
 
 
//! Access for the esr register
//! Access for the esr register
 
 
//! @return  The value of the or1200_sprs.esr register
//! @return  The value of the or1200_sprs.esr register
 
 
uint32_t
uint32_t OrpsocAccess::getSprEsr()
OrpsocAccess::getSprEsr ()
 
{
{
  return  (or1200_sprs->get_esr) ();
  return  (or1200_sprs->get_esr) ();
 
 
}       // getSprEsr ()
}       // getSprEsr ()
 
 
Line 336... Line 321...
{
{
  return  (wb_arbiter->get_gnt) ();
  return  (wb_arbiter->get_gnt) ();
 
 
}       // getWbArbGrant ()
}       // getWbArbGrant ()
 
 
 
 
//! Arbiter master[mast_num] access functions
//! Arbiter master[mast_num] access functions
 
 
//! Access for the arbiter's master[mast_num] data in signal
//! Access for the arbiter's master[mast_num] data in signal
 
 
//! @return  The value of the wb_conmax_top.m_dat_i[mast_num]
//! @return  The value of the wb_conmax_top.m_dat_i[mast_num]
Line 372... Line 356...
{
{
  return  (wb_arbiter->get_m_adr_i) (mast_num);
  return  (wb_arbiter->get_m_adr_i) (mast_num);
 
 
}       // getWbArbMastAdrI ()
}       // getWbArbMastAdrI ()
 
 
 
 
//! Access for the arbiter's master[mast_num] select signal
//! Access for the arbiter's master[mast_num] select signal
 
 
//! @return  The value of the wb_conmax_top.m_sel_i[mast_num]
//! @return  The value of the wb_conmax_top.m_sel_i[mast_num]
 
 
uint8_t
uint8_t

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.