Logo SoCRocket

Transaction-Level Modeling Framework for Space Applications

Public Types | Public Member Functions | Public Attributes | List of all members
Memory Struct Reference

This class models a generic memory. Depending on the configuration it can be used as ROM, IO, SRAM or SDRAM, in conjunction with the SoCRocket MCTRL. More...

#include <memory.h>

Inheritance diagram for Memory:
Collaboration diagram for Memory:

Public Types

enum  { SIZE = 256 }
 
- Public Types inherited from MEMDevice
enum  device_type { ROM = 0, IO = 1, SRAM = 2, SDRAM = 3 }
 Device type. More...
 
typedef device_type type
 

Public Member Functions

 GC_HAS_CALLBACKS ()
 
 Memory (sc_module_name name, MEMDevice::device_type type=MEMDevice::SDRAM, uint32_t banks=2, uint32_t bsize=128 *1024 *1024, uint32_t bits=32, uint32_t cols=16, std::string implementation="ArrayStorage", bool pow_mon=false)
 
 ~Memory ()
 Destructor. More...
 
void start_of_simulation ()
 SystemC start of simulation callback. More...
 
gs::cnf::callback_return_type m_reads_cb (gs::gs_param_base &changed_param, gs::cnf::callback_type reason)
 read counter callback More...
 
gs::cnf::callback_return_type m_writes_cb (gs::gs_param_base &changed_param, gs::cnf::callback_type reason)
 write counter callback More...
 
void before_end_of_elaboration ()
 
void end_of_simulation ()
 SystemC end of simulation. More...
 
void b_transport (tlm::tlm_generic_payload &gp, sc_time &delay)
 TLM 2.0 blocking transport function. More...
 
unsigned int transport_dbg (tlm::tlm_generic_payload &gp)
 TLM 2.0 debug transport function. More...
 
bool get_direct_mem_ptr (tlm::tlm_generic_payload &trans, tlm::tlm_dmi &dmi_data)
 
 SC_HAS_PROCESS (Memory)
 
 Memory (sc_core::sc_module_name mn)
 
virtual void b_transport (tlm::tlm_generic_payload &trans, sc_time &delay)
 
- Public Member Functions inherited from MemoryPower
 GC_HAS_CALLBACKS ()
 
 MemoryPower (sc_module_name name, MEMDevice::device_type type=MEMDevice::SRAM, uint32_t banks=4, uint32_t bsize=128, uint32_t bits=32, uint32_t cols=16, bool pow_mon=false)
 
 ~MemoryPower ()
 
void power_model ()
 Calculate power/energy values from normalized input data. More...
 
gs::cnf::callback_return_type swi_power_cb (gs::gs_param_base &changed_param, gs::cnf::callback_type reason)
 Dynamic/Switching power callback. More...
 
gs::cnf::callback_return_type dyn_reads_cb (gs::gs_param_base &changed_param, gs::cnf::callback_type reason)
 32-bit-reads counter callback More...
 
gs::cnf::callback_return_type dyn_writes_cb (gs::gs_param_base &changed_param, gs::cnf::callback_type reason)
 32-bit-writes counter callback More...
 
gs::cnf::callback_return_type dyn_reads_write_cb (gs::gs_param_base &changed_param, gs::cnf::callback_type reason)
 32-bit-reads counter callback, write More...
 
gs::cnf::callback_return_type dyn_writes_write_cb (gs::gs_param_base &changed_param, gs::cnf::callback_type reason)
 32-bit-writes counter callback, write More...
 
- Public Member Functions inherited from MEMDevice
 MEMDevice (sc_module_name name, device_type type, uint32_t banks=0, uint32_t bsize=0, uint32_t bits=32, uint32_t cols=0)
 
virtual ~MEMDevice ()
 Empty destructor. More...
 
virtual void init_mem_generics ()
 Initialize MEMDevice generics. More...
 
virtual const charget_device_info () const
 Returns the memory configuration. More...
 
virtual const device_type get_type () const
 Returns the device type. More...
 
virtual const std::string get_type_name () const
 Return the device type name. More...
 
virtual const uint32_t get_banks () const
 Returns the number of banks of the memory (sram or sdram bank if needed) More...
 
virtual const uint32_t get_bsize () const
 
virtual const uint32_t get_bits () const
 
virtual const uint32_t get_cols () const
 Returns the column size of the memory (sdram) More...
 
virtual const uint32_t get_size () const
 Returns the size of the whole memory. More...
 
- Public Member Functions inherited from BaseModule< DefaultBase >
 BaseModule (ModuleName mn)
 
virtual ~BaseModule ()
 
virtual void init_generics ()
 
virtual void init_registers ()
 
virtual void init_counters ()
 
virtual void init_power ()
 
- Public Member Functions inherited from CLKDevice
 SR_HAS_SIGNALS (CLKDevice)
 
 CLKDevice ()
 
virtual ~CLKDevice ()
 
virtual void onrst (const bool &value, const sc_core::sc_time &time)
 
virtual void onclk (const sc_core::sc_time &value, const sc_core::sc_time &time)
 
void set_clk (sc_core::sc_clock &clk)
 
void set_clk (sc_core::sc_time period)
 
void set_clk (double period, sc_core::sc_time_unit base)
 
virtual void dorst ()
 
virtual void clkcng ()
 
- Public Member Functions inherited from BaseMemory
 BaseMemory ()
 
 ~BaseMemory ()
 
void set_storage (std::string implementation, uint32_t size)
 
uint8_t read (const uint32_t &addr)
 
uint8_t read_dbg (const uint32_t &addr)
 
void write (const uint32_t &addr, const uint8_t &byte)
 
void write_dbg (const uint32_t &addr, const uint8_t &byte)
 
void write_block (const uint32_t &addr, uint8_t *data, const uint32_t &len)
 
void write_block_dbg (const uint32_t &addr, const uint8_t *data, const uint32_t &len)
 
void read_block (const uint32_t &addr, uint8_t *data, const uint32_t &len)
 
void read_block_dbg (const uint32_t &addr, uint8_t *data, const uint32_t &len) const
 
void erase (const uint32_t &start, const uint32_t &end)
 
void erase_dbg (const uint32_t &start, const uint32_t &end)
 
virtual scireg_ns::scireg_response scireg_get_region_type (scireg_ns::scireg_region_type &t) const
 Get the region_type of this region: More...
 
virtual scireg_ns::scireg_response scireg_read (scireg_ns::vector_byte &v, sc_dt::uint64 size, sc_dt::uint64 offset=0) const
 Read a vector of "size" bytes at given offset in this region: More...
 
virtual scireg_ns::scireg_response scireg_write (const scireg_ns::vector_byte &v, sc_dt::uint64 size, sc_dt::uint64 offset=0)
 Write a vector of "size" bytes at given offset in this region: More...
 
virtual sc_dt::uint64 scireg_get_bit_width () const
 Get bit width and byte width of this region. More...
 
virtual sc_dt::uint64 scireg_get_low_pos () const
 If this region is a register field, these functions return low bit and high bit positions: More...
 
virtual sc_dt::uint64 scireg_get_high_pos () const
 
virtual scireg_ns::scireg_response scireg_get_dmi_granted (bool &granted, sc_dt::uint64 size, sc_dt::uint64 offset=0) const
 Query to see if DMI access has been granted to this region. "size" and offset can be used to constrain the range. More...
 
- Public Member Functions inherited from scireg_ns::scireg_region_if
 scireg_region_if ()
 
virtual ~scireg_region_if ()
 
virtual scireg_response scireg_get_bit_attributes (vector_byte &v, scireg_bit_attributes_type t, sc_dt::uint64 size, sc_dt::uint64 offset=0) const
 Get bit attributes of type "t" into "v". "size" represents number of bytes returned, offset can be used to constrain the range. More...
 
virtual scireg_response scireg_get_string_attribute (const char *&s, scireg_string_attribute_type t) const
 Get string attributes of type "t" associated with this region. The returned string is assigned to "s". More...
 
virtual sc_dt::uint64 scireg_get_byte_width () const
 
virtual scireg_response scireg_get_child_regions (std::vector< scireg_mapped_region > &mapped_regions, sc_dt::uint64 size=sc_dt::uint64(-1), sc_dt::uint64 offset=0) const
 
virtual scireg_response scireg_get_parent_regions (std::vector< scireg_region_if * > &v) const
 Get parent regions of this region. More...
 
virtual scireg_response scireg_add_callback (scireg_callback &cb)
 Add/Delete Callback objects associated with this region. More...
 
virtual scireg_response scireg_remove_callback (scireg_callback &cb)
 
virtual scireg_response scireg_get_target_sockets (std::vector< sc_core::sc_object * > &v) const
 Get SC TLM2 Target socket associated with this region. More...
 
virtual scireg_response scireg_get_parent_modules (std::vector< sc_core::sc_module * > &v) const
 Get parent SystemC modules associated with this region. More...
 
virtual scireg_response scireg_get_value_info (std::vector< scireg_value_info > &v) const
 Get a vector of value_info objects for this region. More...
 

Public Attributes

gs::socket::target_socket< 32 > bus
 Slave socket - for communication with Mctrl. More...
 
sr_param< uint64_tm_writes
 
sr_param< uint64_tm_reads
 
sr_param< std::string > g_storage_type
 
sr_param< std::string > g_elf_file
 
tlm_utils::simple_target_socket
< Memory
socket
 
int mem [SIZE]
 
- Public Attributes inherited from MemoryPower
bool m_pow_mon
 Power monitoring. More...
 
gs::cnf::cnf_api * m_api
 GreenControl API Pointer. More...
 
gs::gs_param_array m_performance_counters
 Performance Counter Array. More...
 
gs::gs_param_array power
 Performance counter to store transaction byte reads. More...
 
sr_param< doublesta_power_norm
 Normalized static power input. More...
 
sr_param< doubleint_power_norm
 Normalized internal power input (activation independent) More...
 
sr_param< doubledyn_read_energy_norm
 Normalized read access energy. More...
 
sr_param< doubledyn_write_energy_norm
 Normalized write access energy. More...
 
sr_param< doublesta_power
 Static power of module. More...
 
sr_param< doubleint_power
 Internal power of module. More...
 
sr_param< doubleswi_power
 Switching power of module. More...
 
sr_param< sc_core::sc_time > power_frame_starting_time
 Power frame starting time. More...
 
sr_param< doubledyn_read_energy
 Dynamic energy per read access. More...
 
sr_param< doubledyn_write_energy
 Dynamic energy per write access. More...
 
sr_param< uint64_tdyn_reads
 Number of reads from memory (read & reset by monitor) More...
 
sr_param< uint64_tdyn_writes
 Number of writes to memory (read & reset by monitor) More...
 
- Public Attributes inherited from CLKDevice
signal< bool >::in rst
 Reset input signal. More...
 
signal< sc_core::sc_time >::in clk
 Clock input signal. More...
 
- Public Attributes inherited from BaseMemory
unsigned long long reads
 byte read count More...
 
unsigned long long writes
 byte write count More...
 
unsigned long long reads32
 word (4 bytes) read count More...
 
unsigned long long writes32
 word (4 bytes) write count More...
 

Additional Inherited Members

- Protected Attributes inherited from BaseModule< DefaultBase >
ParameterAPIm_api
 Internal module gs param api instance. More...
 
ParameterArray m_generics
 Configuration generic container. More...
 
ParameterArray m_counters
 Performance counter container. More...
 
ParameterArray m_power
 Power counters container. More...
 
- Protected Attributes inherited from CLKDevice
sc_core::sc_time clock_cycle
 
- Protected Attributes inherited from BaseMemory
Storagem_storage
 

Detailed Description

This class models a generic memory. Depending on the configuration it can be used as ROM, IO, SRAM or SDRAM, in conjunction with the SoCRocket MCTRL.

Member Enumeration Documentation

anonymous enum
Enumerator
SIZE 

Constructor & Destructor Documentation

Memory::Memory ( sc_module_name  name,
MEMDevice::device_type  type = MEMDevice::SDRAM,
uint32_t  banks = 2,
uint32_t  bsize = 128 *1024 *1024,
uint32_t  bits = 32,
uint32_t  cols = 16,
std::string  implementation = "ArrayStorage",
bool  pow_mon = false 
)

Creates a new Instance of Memory

Parameters
nameThe SystemC name of the component to be created
typeThe type of memory to be modeled (0-ROM, 1-IO, 2-SRAM, 3-SDRAM)
banksNumber of parallel banks
bsizeSize of one memory bank in bytes (all banks always considered to have equal size)
bitsBit width of memory
colsNumber of SDRAM cols.
Memory::Memory ( sc_core::sc_module_name  mn)
inline

References b_transport(), i, and mem.

Here is the call graph for this function:

Member Function Documentation

virtual void Memory::b_transport ( tlm::tlm_generic_payload &  trans,
sc_time &  delay 
)
inlinevirtual

References mem.

Memory::GC_HAS_CALLBACKS ( )
Memory::SC_HAS_PROCESS ( Memory  )

Member Data Documentation

gs::socket::target_socket<32> Memory::bus

Slave socket - for communication with Mctrl.

Referenced by sc_main().

sr_param<std::string> Memory::g_elf_file
sr_param<std::string> Memory::g_storage_type
sr_param<uint64_t> Memory::m_reads
sr_param<uint64_t> Memory::m_writes
int Memory::mem[SIZE]
tlm_utils::simple_target_socket<Memory> Memory::socket

The documentation for this struct was generated from the following files: