Skip to content

Class simtix::mem::SimpleMemory

ClassList > simtix > mem > SimpleMemory

A simple memory implementation with fixed latency.

  • #include <mem.h>

Inherits the following classes: simtix::mem::MemoryInterface

Classes

Type Name
class Impl
struct Param

Public Types inherited from simtix::mem::MemoryInterface

See simtix::mem::MemoryInterface

Type Name
typedef std::function< bool(RespStatus)> OnResp
enum uint8_t RespStatus

Public Static Attributes

Type Name
const Param kDefaultParam = /* multi line expression */

Public Functions

Type Name
virtual bool Read (Payload payload, OnResp on_resp) override
Enqueue a read request to the request queue.
SimpleMemory (const std::string & name, const Param & param=kDefaultParam)
Constructor of SimpleMemory .
SimpleMemory (const SimpleMemory & s) = delete
virtual bool Write (Payload payload, OnResp on_resp) override
Enqueue a write request to the request queue.
SimpleMemory operator= (const SimpleMemory & s) = delete
virtual uint8_t & operator[] (const uint64_t addr) override
The operator[] is used by the simulator to read or modify memory directly.
~SimpleMemory ()

Public Functions inherited from simtix::mem::MemoryInterface

See simtix::mem::MemoryInterface

Type Name
MemoryInterface (const std::string & name, sim::TickPri pri=sim::kMemTickPri)
virtual bool Read (Payload payload, OnResp on_resp)
Enqueue a read request to the request queue.
virtual bool Write (Payload payload, OnResp on_resp)
Enqueue a write request to the request queue.
virtual uint8_t & operator[] (const uint64_t addr) = 0
The operator[] is used by the simulator to read or modify memory directly.
virtual ~MemoryInterface () = default

Public Functions inherited from simtix::sim::Clocked

See simtix::sim::Clocked

Type Name
Clocked (const std::string & name, TickPri pri=kDefaultPri)
Constructor for clocled.
const std::string & name () const
Get the name of the clocked object.
virtual ~Clocked ()

Protected Attributes

Type Name
std::unique_ptr< Impl > impl_

Protected Attributes inherited from simtix::sim::Clocked

See simtix::sim::Clocked

Type Name
std::string name_
TickPri pri_

Protected Static Attributes inherited from simtix::sim::Clocked

See simtix::sim::Clocked

Type Name
bool busy_ = true
std::map< TickPri, std::vector< Clocked * > > clocked_objs_map_
uint64_t cur_tick_ = 0

Protected Functions

Type Name
virtual bool HasPendingTasks () override
Check if SimpleMemory have pending tasks at the current tick.
virtual void Tick () override
Perform memory operation cycle.

Protected Functions inherited from simtix::sim::Clocked

See simtix::sim::Clocked

Type Name
virtual bool HasPendingTasks () = 0
Checks if any registered clocked objects have pending tasks at the current tick.
virtual void Tick () = 0
Global tick function that advances the simulation by one cycle.

Protected Static Functions inherited from simtix::sim::Clocked

See simtix::sim::Clocked

Type Name
void Register (Clocked * c)
Register a clocked object to participate in tick-driven simulation.
void Unregister (Clocked * c)
Unregister a clocked object from tick-driven simulation.

Public Static Attributes Documentation

variable kDefaultParam

const Param simtix::mem::SimpleMemory::kDefaultParam;

Public Functions Documentation

function Read

Enqueue a read request to the request queue.

virtual bool simtix::mem::SimpleMemory::Read (
    Payload payload,
    OnResp on_resp
) override

Parameters:

  • payload Payload for the read operation.
  • on_resp Callback for the response.

Returns:

True if enqueued successfully.

Implements simtix::mem::MemoryInterface::Read


function SimpleMemory [1/2]

Constructor of SimpleMemory .

explicit simtix::mem::SimpleMemory::SimpleMemory (
    const std::string & name,
    const Param & param=kDefaultParam
) 

Parameters:

  • name Name of the simple memory.
  • param Memory configuration parameters.

function SimpleMemory [2/2]

simtix::mem::SimpleMemory::SimpleMemory (
    const SimpleMemory & s
) = delete

function Write

Enqueue a write request to the request queue.

virtual bool simtix::mem::SimpleMemory::Write (
    Payload payload,
    OnResp on_resp
) override

Parameters:

  • payload Payload for the write operation.
  • on_resp Callback for the response.

Returns:

True if enqueued successfully.

Implements simtix::mem::MemoryInterface::Write


function operator=

SimpleMemory simtix::mem::SimpleMemory::operator= (
    const SimpleMemory & s
) = delete

function operator[]

The operator[] is used by the simulator to read or modify memory directly.

virtual uint8_t & simtix::mem::SimpleMemory::operator[] (
    const uint64_t addr
) override

Implements simtix::mem::MemoryInterface::operator[]


function ~SimpleMemory

simtix::mem::SimpleMemory::~SimpleMemory () 

Protected Attributes Documentation

variable impl_

std::unique_ptr<Impl> simtix::mem::SimpleMemory::impl_;

Protected Functions Documentation

function HasPendingTasks

Check if SimpleMemory have pending tasks at the current tick.

virtual bool simtix::mem::SimpleMemory::HasPendingTasks () override

Returns:

True if there are pending tasks, false otherwise.

Implements simtix::sim::Clocked::HasPendingTasks


function Tick

Perform memory operation cycle.

virtual void simtix::mem::SimpleMemory::Tick () override

Implements simtix::sim::Clocked::Tick



The documentation for this class was generated from the following file projects/simtix/include/simtix/mem.h