Class: PipelineSim::MainMem

Inherits:
Object
  • Object
show all
Defined in:
pipeline_simulation.rb

Overview

This is the class that creates the simulated main memory

Initialization:

main_memory = PipelineSim::MainMem.new(size)
After initialization, @content is the only thing that can be changed

Definition of parameters:

size: integer, reflects the total size of main memory array

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(size) ⇒ MainMemory

Note:

This function just creates dummy data in the main memory. Currently it fills it with hexadecimal numbers.

Initializes new MainMemory object

Parameters:

  • size (Integer)

    reflects the total size of main memory array



375
376
377
# File 'pipeline_simulation.rb', line 375

def initialize(size)
  @content = initialize_content(size)
end

Instance Attribute Details

#contentArray

Returns the content of the cache

Returns:

  • (Array)

    array of strings representing current data in the cache



369
370
371
# File 'pipeline_simulation.rb', line 369

def content
  @content
end