[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following classes are supported for representing internal devices in a computer. Each device only support the target hardware function. Communication with ports and packets, nor intelligent clock driven operation are not supported.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
cache_line_base
class is the base class for cache lines. In
the object, address tag of the cache line and cache line data is
included. This class is a class template with three parameters: the
first parameter is address type, the second is data type and the third
is the container type. The state of the cache line is not defined.
Actual state of cache line is needed to be defined in the derived
class.
In derived class, the following virtual functions must be defined.
virtual bool is_valid(void) const
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
simple_cache_line
class represents simple cache lines with a
state, valid or invalid. It is a derived class of
cache_line_base
. See section 7.1 cache_line_base class.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
cache_line_set
class represents cache lines corresponding to
the number of ways. It is a template class whose parameter is type of
the cache line. For a two-way cache, the object of this class
includes two cache line. For management of the replacement, LRU
counter is provided. See section 7.1 cache_line_base class.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
direct_map_cache
class represents direct map caches. It is a
class template whose parameter is type of cache line. Cache size and
line size must be power of 2. If the size other than power of 2 is
set, it is automatically truncated to the larger number of power of 2.
directmap_cache(address_type a, address_type b)
address_type cache_size(void) const
address_type line_size(void) const
size_t line_size_in_word(void) const
address_type tag_address(address_type) const
bool is_hit(address_type) const
bool is_valid(address_type) const
address_type read_address(address_type) const
data_type read(address_type) const
void write(address_type a, data_type b)
void clear(void)
void resize(address_type, address_type)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
set associative cache
class represents set associate cache
devices. It is implemented as a class template with a parameter of
cache line type. See section 7.1 cache_line_base class.
set_associative_cache(address_type a, address_type b, size_t c)
const line_set_type& cache_line_set(address_type) const
line_set_type& cache_line_set(address_type)
address_type cache_size(void) const
address_type line_size(void) const
size_t way_size(void) const
size_t line_size_in_word(void) const
int max_lru_counter(void) const
address_type tag_address(address_type) const
size_t line_offset(address_type) const
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
instruction_buffer
class represents pipelined instruction
buffers. It is a class template whose parameter is an instruction
type. The stage is shifted by calling step
function. For
example, a stage referred in stage 0 is accessed in the stage 1 in the
next time step.
size_t size(void) const
value_type& operator[](size_t i)
void clear(void)
void step(void)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
register_file
class represents a register file. It is a class
template whose parameter is a type of the register. Although its
function is similar to that of a subset of STL vector
, resizing
after object generation is prohibited.
const_reference operator[](size_t i) const
reference operator[](size_t i)
size_type size(void) const
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
write_buffer
class represents a write buffer for CPU. It is a
queue which stores a pair of address and data. It is a template class
with address_type
and data_type
as parameters.
size_t size(void) const
size_t length(void) const
bool empty(void) const
bool full(void) const
bool buffered(address_type) const
data_type read(address_type) const
address_type address(void) const
data_type data(void) const
void clear(void)
void push(address_type, data_type&)
void pop(void)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
memory
class template represents hardware storages. The
address type is indicated as the first parameter, and the data is with
the second parameter. This class itself does not represents an unit.
Neither state transition nor clock (time) is included. For using this
memory
in the simulator, the functions corresponding to the
memory controller should be attached.
memory
class manages the size of storage represented with
bytes.
Miss aligned access is automatically aligned to the word boundary. Bytes are accessed according to the indicated endian. Default is a big endian.
7.9.1 memory class definition 7.9.2 Using memory class
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
memory(void)
memory(address_type a)
address_type size(void) const
bool is_valid(address_type) const
void resize(address_type)
bool is_big_endian(void) const
bool is_little_endian(void) const
void set_big_endian(void)
void set_little_endian(void)
data_type read(address_type) const
char_type read_char(address_type) const
void write(address_type, data_type)
void write_char(address_type, char_type)
void clear(void)
void dump(ostream&) const
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
memory
class internally uses dynamically page management, that
is, a requested size is not allocated instantly. When the size other
than 0 is written, the page is allocated. Thus, resource is only
allocated when really used even if the huge memory size is requested.
The following example requests 1Gbyte memory starts from
0x10000000
, and write data 0xffffffff
into address from
0x2000
to 0x3000
.
typedef unsigned word; const word size = 1024 * 1024 * 1024; // size: 1G const word area_top = 0x2000, area_size = 0x1000; memory<word, word> mem(size); for (int i = 0; i < area_size; i += sizeof(word)) { write(area_top + i, 0xffffffffU); } |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mapped_memory
class represents memory block on the memory map.
The top address and size are managed. Memory in the buffer is
implemented with memory
.
mapped_memory(void)
mapped_memory(address_type a, address_type b)
address_type top(void) const
size_type size(void) const
address_type bottom(void) const
bool is_valid(address_type) const
address_type top(address_type)
void resize(size_type)
bool is_big_endian(void) const
bool is_little_endian(void) const
void set_big_endian(void)
void set_little_endian(void)
data_type read(address_type) const
char_type& read_char(address_type) const
void write(address_type, data_type)
void write_char(address_type, char_type)
void clear(void)
void dump(ostream&) const
void dump(ostream&, address_type a, address_type b) const
virtual void disassemble(ostream&, address_type a, address_type b) const
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
memory_map
class supports memory maps with integrated address
space. It provides an interface for representing the entire memory.
bool is_valid(address_type) const
data_type read(address_type) const
char_type read_char(address_type) const
void write(address_type, data_type)
void write_char(address_type, char_type)
void insert(const mapped_memory_type&)
void erase(const mapped_memory_type&)
void dump(ostream&) const
void dump(ostream&, address_type a, address_type b) const
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
sysinfo_map
class generates the database including architecture
specific information. It is used for communication of a memory map or
execution results between a host machine and a simulator software.
Each value can store an integer or a string.
void set(const string&, T)
void set(const string&, const string&)
void unset(const string&)
void clear(void)
bool is_defined(const string&)
bool is_integer(const string&)
bool is_string(const string&)
T get_integer(const string&)
const string& get_string(const string&)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
fileio_map
class generates a database for file tables. It is
used for accessing files from simulated softwares. It maps file
access requests to stream operations including standard input/output.
A file table is 0-origin one dimensional array. Each file is managed
with the following 3 attributes and the substance itself.
void fileio_map(void)
void fileio_map(size_t)
void set_standard_io(void)
cin
, file 1 is done with cout
and file 2 is done with
cerr
.
size_t size(void) const
void resize(size_t)
bool is_readable(size_t)
bool is_writable(size_t)
bool is_opened(size_t)
void set_input_stream(size_t, istream&)
void set_output_stream(size_t, ostream&)
bool open(size_t, const char*, int)
IO_FILE_OPEN_*
in `io_protocol.h'. True is returned
if it is successful.
bool close(size_t)
bool eof(size_t) const
bool good_input_stream(size_t) const
bool good_output_stream(size_t) const
bool put(size_t, char)
bool get(size_t, &char)
long seek(size_t, long, int)
lseek
to the file indicated in the first argument. The
third argument represents the position form and the second shows the
position itself. The position form specification is shown in macro
IO_FILE_SEEK_*
in `io_protocol.h'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
argument_map
class generates a database which manages the
command line parameters. It is used for reading command line
information by a simulated software.
int argc(void) const
argc
.
const char* argv(size_t) const
argv
.
void set(const char* const*)
void clear(void)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
crossbar
class represents crossbars. It includes (input line
number x output line number) switches, and connections between input
lines and output lines are controlled by them.
crossbar(void)
crossbar(size_t a, size_t b)
size_t input_size(void) const
size_t output_size(void) const
void resize(size_t a, size_t b)
void clear(void)
inline void connect_crosspoint(size_t a, size_t b)
inline void disconnect_crosspoint(size_t a, size_t b)
bool is_connected_input_channel(size_t)
bool is_connected_output_channel(size_t)
inline void disconnect_input_channel(size_t)
inline void disconnect_output_channel(size_t)
size_t input_to_output_size(size_t)
size_t input_to_output_index(size_t a, size_t b = 0)
size_t output_to_input_index(size_t)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
network_packet_sender
class is a support class for
implementation of the network interface units. It is used connecting
with the router. Input packets are divided into multiple flits and
sent to the network.
virtual_channel_output& channel(void)
bool empty(void) const
bool full(void) const
void put(packet_type*)
void clock(void)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
network_packet_receiver
class is a support class for
implementing network interface units. It is used connecting with the
router. A set of flit from the network and forms a packet.
virtual_channel_input& channel(void)
bool full(void) const
packet_type* get(void)
void clock(void)
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |