# GXemul: Components: `ram`

Back to the index.

Back to the component index.

## `ram` component

The `ram` component represents a Random Access Memory.

Note that also ROM (Read-Only Memory) circuits are emulated using this component. A ROM circuit is a RAM with `writeProtect = true`.

The following example shows how to interactively add a `ram` component to a machine:

    $ gxemul -V
    ..
    GXemul> add machine
    GXemul> add mainbus machine0
    GXemul> root
      root
      \-- machine0
          \-- mainbus0

      accuracy = cycle
      step     = 0
    GXemul> add ram mainbus0
    GXemul> ram
      ram0  (0 bytes at offset 0)

      data                = (custom)
      lastDumpAddr        = 0
      memoryMappedAddrMul = 0x1
      memoryMappedBase    = 0
      memoryMappedSize    = 0
      step                = 0
      writeProtect        = false
    GXemul> ram0.memoryMappedSize = 0x400000
    GXemul> root
      root
      \-- machine0
          \-- mainbus0
              \-- ram0  (4 MB at offset 0)

      accuracy = cycle
      step     = 0
    GXemul>

Source code for this component can be found here (and Doxygen documentation here).