From 97d84e06e0fd573af6f18b328176ba1143fefbb0 Mon Sep 17 00:00:00 2001 From: bje Date: Thu, 21 Jun 2001 12:49:39 +0000 Subject: [PATCH] 2001-06-21 Ben Elliston * generic.h (generic_memory::read_latency): New member. (generic_memory::write_latency): Likewise. (generic_read_write_bus::write_any): Set write latency on return. (generic_read_only_bus::read_any): Likewise for read latency. * generic.cxx (generic_memory constructor): Initialise new read_latency and write_latency members. Add attributes for them. * hw-memory-ram_rom-basic.txt: Document extensions. * hw-memory-flash-am29.txt: Likewise. * hw-memory-flash-at29.txt: Likewise. --- sid/component/memory/ChangeLog | 18 +++++++++++++++--- sid/component/memory/generic.cxx | 7 ++++++- sid/component/memory/generic.h | 12 ++++++++++-- sid/component/memory/hw-memory-flash-am29.txt | 12 +++++++++++- sid/component/memory/hw-memory-flash-at29.txt | 12 +++++++++++- sid/component/memory/hw-memory-ram_rom-basic.txt | 11 ++++++++++- 6 files changed, 63 insertions(+), 9 deletions(-) diff --git a/sid/component/memory/ChangeLog b/sid/component/memory/ChangeLog index 45a21804cf..b6c4c0898a 100644 --- a/sid/component/memory/ChangeLog +++ b/sid/component/memory/ChangeLog @@ -1,7 +1,19 @@ - 2001-03-26 Frank Ch. Eigler +2001-06-21 Ben Elliston + + * generic.h (generic_memory::read_latency): New member. + (generic_memory::write_latency): Likewise. + (generic_read_write_bus::write_any): Set write latency on return. + (generic_read_only_bus::read_any): Likewise for read latency. + * generic.cxx (generic_memory constructor): Initialise new + read_latency and write_latency members. Add attributes for them. + * hw-memory-ram_rom-basic.txt: Document extensions. + * hw-memory-flash-am29.txt: Likewise. + * hw-memory-flash-at29.txt: Likewise. + +2001-03-26 Frank Ch. Eigler - * generic.cxx (image{load,store,mmap}_handler): Use find_sid_data_file - to locate image-file. + * generic.cxx (image{load,store,mmap}_handler): Locate image-file + using find_sid_data_file. 2001-03-16 Frank Ch. Eigler diff --git a/sid/component/memory/generic.cxx b/sid/component/memory/generic.cxx index 97c42eda25..1bb81ad797 100644 --- a/sid/component/memory/generic.cxx +++ b/sid/component/memory/generic.cxx @@ -55,7 +55,9 @@ generic_memory::generic_memory() throw (bad_alloc): imageload_pin (this, & generic_memory::imageload_handler), imagestore_pin (this, & generic_memory::imagestore_handler), imagemmap_pin (this, & generic_memory::imagemmap_handler), - imagemsync_pin (this, & generic_memory::imagemsync_handler) + imagemsync_pin (this, & generic_memory::imagemsync_handler), + read_latency (0), + write_latency (0) { this->max_buffer_length = 32UL * 1024UL * 1024UL; this->buffer = 0; @@ -80,6 +82,9 @@ generic_memory::generic_memory() throw (bad_alloc): add_pin ("image-msync", & this->imagemsync_pin); add_attribute ("image-msync", & this->imagemsync_pin, "pin"); + add_attribute ("read-latency", & this->read_latency, "setting"); + add_attribute ("write-latency", & this->write_latency, "setting"); + add_attribute_virtual ("state-snapshot", this, & generic_memory::save_state, & generic_memory::restore_state); diff --git a/sid/component/memory/generic.h b/sid/component/memory/generic.h index 97c457ae29..ef8e4e4fa1 100644 --- a/sid/component/memory/generic.h +++ b/sid/component/memory/generic.h @@ -36,6 +36,7 @@ using std::ifstream; using sid::component; using sid::bus; using sid::host_int_1; +using sid::host_int_2; using sid::host_int_4; using sid::little_int_1; using sid::little_int_2; @@ -97,6 +98,9 @@ private: string get_size_attr (); component::status set_size_attr (const string& s); + host_int_2 read_latency; + host_int_2 write_latency; + string image_file_name; callback_pin imageload_pin; void imageload_handler (host_int_4); @@ -208,7 +212,9 @@ generic_read_write_bus::write_any(host_int_4 address, DataType data) { typename DataType::value_type mem_image = data.target_memory_value(); memcpy (& target->buffer[address], & mem_image, width); - return bus::ok; + bus::status st (bus::ok); + st.latency = target->write_latency; + return st; } return bus::unmapped; @@ -227,7 +233,9 @@ generic_read_only_bus::read_any(host_int_4 address, DataType& data) typename DataType::value_type mem_image; memcpy (& mem_image, & target->buffer[address], width); data.set_target_memory_value (mem_image); - return bus::ok; + bus::status st (bus::ok); + st.latency = target->read_latency; + return st; } return bus::unmapped; diff --git a/sid/component/memory/hw-memory-flash-am29.txt b/sid/component/memory/hw-memory-flash-am29.txt index 3e1f3c0176..7348043f9e 100644 --- a/sid/component/memory/hw-memory-flash-am29.txt +++ b/sid/component/memory/hw-memory-flash-am29.txt @@ -7,7 +7,8 @@ Buses: read-write-port Pins: image-load image-store - Attributes: device-code image-file manufacturer-code mode sector-size size size-max + Attributes: device-code image-file manufacturer-code mode + sector-size size size-max read-latency write-latency Library: libmemory.la Symbol name: mem_component_library @@ -73,9 +74,16 @@ device state machine. This is primarily designed for testing purposes. + * Memory latency + + The component models the effects of memory latency. The + read-latency and write-latency attribute values specify the + latencies for memory reads and writes, respectively. + - SID conventions * This is a functional component. + * The component models memory latency. * The component supports saving and restoring state in addition to memory persistence, via the image-store pin/attribute. * Triggerpoints are not supported. @@ -122,6 +130,8 @@ - sector-size | setting | numeric | 65536 | configuration - image-file | setting | filename | | image save/load - mode | | 0 .. 9 | 0 for read mode | reading/writing + - read-latency | setting | default 0 | memory latency + - write-latency | setting | default 0 | memory latency * pins - image-load | input | any | image load/store diff --git a/sid/component/memory/hw-memory-flash-at29.txt b/sid/component/memory/hw-memory-flash-at29.txt index c3eeafbe2d..2a53abcfec 100644 --- a/sid/component/memory/hw-memory-flash-at29.txt +++ b/sid/component/memory/hw-memory-flash-at29.txt @@ -8,7 +8,8 @@ Buses: read-write-port Pins: image-load image-store - Attributes: device-code image-file manufacturer-code sector-size size size-max + Attributes: device-code image-file manufacturer-code sector-size + size size-max read-latency write-latency Library: libmemory.la Symbol name: mem_component_library @@ -81,9 +82,16 @@ be followed when writing to the memory - see ATMEL documentation. + * Memory latency + + The component models the effects of memory latency. The + read-latency and write-latency attribute values specify the + latencies for memory reads and writes, respectively. + - SID conventions * This is a functional component. + * The component models memory latency. * The component supports saving and restoring state in addition to memory persistence, via the image-store pin/attribute. * Triggerpoints are not supported. @@ -129,6 +137,8 @@ - size-max | setting | numeric | fixed at 32MB | configuration - sector-size | setting | numeric | 512 | configuration - image-file | setting | filename | | image save/load + - read-latency | setting | default 0 | memory latency + - write-latency | setting | default 0 | memory latency * pins - image-load | input | any | image load/store diff --git a/sid/component/memory/hw-memory-ram_rom-basic.txt b/sid/component/memory/hw-memory-ram_rom-basic.txt index ecf9dcc899..d28e5ed382 100644 --- a/sid/component/memory/hw-memory-ram_rom-basic.txt +++ b/sid/component/memory/hw-memory-ram_rom-basic.txt @@ -9,7 +9,7 @@ Buses: read-only-port read-write-port Pins: image-load image-store image-mmap image-msync error Attributes: size size-max image-file image-load image-store - state-snapshot + state-snapshot read-latency write-latency Library: libmemory.la Symbol name: mem_component_library @@ -64,6 +64,12 @@ configure the connection from this pin to some system-wide recepient before failure-prone component configuration occurs. + * Memory latency + + The component models the effects of memory latency. The + read-latency and write-latency attribute values specify the + latencies for memory reads and writes, respectively. + * Reading/writing When an access is received on either the "read-only-port" or @@ -77,6 +83,7 @@ - SID conventions * This is a functional component. + * The component models memory latency. * The component supports saving and restoring state in addition to memory persistence, via the image-store pin/attribute. * Triggerpoints are not supported. @@ -126,6 +133,8 @@ * attributes - size | setting | numeric | default 0 | configuration - size-max | setting | numeric | fixed at 32MB | configuration + - read-latency | setting | numeric | default 0 | memory latency + - write-latency | setting | numeric | default 0 | memory latency - image-file | setting | filename | no default | image save/load - image-load | pin | any | no default | image save/load - image-store | pin | any | no default | image save/load -- 2.11.0