Class: PipelineSim::PipelineRegister

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

Overview

This is the class that creates the simulated pipeline registers

Initialization:

@IfIdRegister = PipelineRegister.new("IF/ID Register", {instruction: "0x00000000"})
After initialization, both @read and @write can be updated, but not @title

Definition of parameters:

title: string, name of register
read: hash, contents of the read side
write: hash, contents of the write side

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, hash) ⇒ PipelineRegister

Initializes new pipeline register object

Parameters:

  • title (String)

    name of register

  • hash (Hash)

    the initialization value of the register's read/write sides



456
457
458
459
460
# File 'pipeline_simulation.rb', line 456

def initialize(title, hash)
  @title = title
  @read = hash
  @write = hash
end

Instance Attribute Details

#readHash

Returns the content of the read side of the register

Returns:

  • (Hash)

    hash representing the contents of the read side



448
449
450
# File 'pipeline_simulation.rb', line 448

def read
  @read
end

#titleString (readonly)

Returns the title of the register

Returns:

  • (String)

    title of the register



445
446
447
# File 'pipeline_simulation.rb', line 445

def title
  @title
end

#writeHash

Returns the content of the write side of the register

Returns:

  • (Hash)

    hash representing the contents of the write side



451
452
453
# File 'pipeline_simulation.rb', line 451

def write
  @write
end