RedstoneChips

sram

An emulation of a TTL74219 SRAM chip. Can store any amount of data words of any bit-length each. Allows for reading and writing the memory data by specifing a memory address.

The number of outputs determines the word-length of the memory chip. 2 control inputs are required:

When a 2nd ‘readonly’ argument is added the chip should be built without the read-write pin and without any data input pins. The chip is always in read mode. In this mode the chips memory contents should be set either with /rctype or by directly editing the chips data file (see more info below).

For example, a memory of 16x4 bits (16 words of 4 bits each) requires 10 inputs - 2 control pins, 4 address pins, and 4 data pins - and 4 outputs. In readonly mode the same memory size requires only 5 inputs - 1 disable pin and 4 address pins.

To read a word from memory:

To write a word to memory (not possible in readonly mode):

It’s also possible to edit the memory contents directly using /rctype. To set the memory at a certain address to a new value use /rctype <address>:<value>. More than one address can be changed with the same command. If the address (and colon) is omitted the typed value is set to address 0 with any additional values set at the next addresses.

For example to set the 1st 5 words enter: /rctype 0 5 16 7 9. Combining specific addresses is possible as well: /rctype 0 6:8 5 16 7 9 will set the 1st 6 bits to 0,5,16,7,9,8. The word value can be typed in various formats:

Use /rctype ascii <ascii string> to enter a string of ascii characters. For ex. /rctype ascii Some text and some more text. Will write 28 8bit words into memory with the ascii codes of each input character.

To see a printout of the current memory data use /rctype dump. For viewing a specific range of addresses, type /rctype dump <first address>..[last address]

The sram’s memory data is stored in a separate file inside <plugins folder>/RedstoneChips/sram folder, when the plugin saves its data. The values are reloaded when the circuit is initalized. Once the circuit is destroyed or reset the memory file is deleted unless a memory id argument is used. Any sram files in the RedstoneChips folder are moved into the sram folder on startup. A memory id sign argument can specify a permanent id for this memory chip. When used the plugin will never delete its memory data file and try to use an existing memory data file if one is found. Therefore /rcreset for ex., will not clear the memory data in this mode. A valid id must start with a letter and may contain letters, digits, or underscores (_).

Any number of sram chips that use the same memory id will share their data contents in server memory as well as on file. Any change made by one of the srams will immediately affect all other chips.

The filename format for the data file is sram-<memory id>.data while memory-id is either an unused id, generated on first chip init or the memory id specified in the sign argument.

on Wikipeda

source code


I/O setup

Sign text

  1. sram
  2. [memory id] (optional)
  3. readonly (optional)

Version history: Added to BasicCircuits 0.87

Fork me on GitHub