Class: PipelineSim::Regs

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

Overview

This is the class that creates the simulated registers

Initialization:

regs = Regs.new(size)
After initialization, @content is the only thing that can be changed

Definition of parameters:

size: integer, reflects the total size of register array

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(size) ⇒ Regs

Note:

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

Initializes new Regs object

Parameters:

  • size (Integer)

    reflects the total size of register array



411
412
413
# File 'pipeline_simulation.rb', line 411

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

Instance Attribute Details

#contentArray

Returns the content of the register

Returns:

  • (Array)

    array of strings representing current data in the register



405
406
407
# File 'pipeline_simulation.rb', line 405

def content
  @content
end

Instance Method Details

#showvoid

This method returns an undefined value.

Prints out contents of the register



417
418
419
# File 'pipeline_simulation.rb', line 417

def show
  puts "Regs: " + @content.join(', ')
end