Class: HDLRuby::High::Std::PipelineT::PipeSignal

Inherits:
Object
  • Object
show all
Includes:
HExpression
Defined in:
lib/HDLRuby/std/pipeline.rb

Overview

The pipeline signal generator class

Instance Attribute Summary collapse

Attributes included from HExpression

#systemT

Instance Method Summary collapse

Methods included from HExpression

#[], #as, #coerce, #constant?, #inout, #input, #ljust, #lr, #ls, #match_type, #mux, orig_operator, #orig_operator, #output, #rjust, #rr, #rs, #sext, #to_bit, #to_unsigned, #to_value, #to_value?, #zext

Constructor Details

#initialize(name, scope) ⇒ PipeSignal

Create a new pipeline signal generator with +name+ whose resulting signal is to be added to +scope+.



30
31
32
33
34
35
# File 'lib/HDLRuby/std/pipeline.rb', line 30

def initialize(name,scope)
    @name  = name.to_sym
    @scope = scope
    @type = nil
    @signal = nil
end

Instance Attribute Details

#nameObject (readonly)

The name of the signal to generate



24
25
26
# File 'lib/HDLRuby/std/pipeline.rb', line 24

def name
  @name
end

#signalObject (readonly)

The generated signal



26
27
28
# File 'lib/HDLRuby/std/pipeline.rb', line 26

def signal
  @signal
end

#typeObject (readonly)

The type of the signal to generate



25
26
27
# File 'lib/HDLRuby/std/pipeline.rb', line 25

def type
  @type
end

Instance Method Details

#<=(expr) ⇒ Object

Assigns +expr+ to the signal. Is the signal is not generated yet, generate it.



39
40
41
42
43
44
45
46
47
48
# File 'lib/HDLRuby/std/pipeline.rb', line 39

def <=(expr)
    # Ensures expr is an expression
    expr = expr.to_expr
    # Generate the signal if not existant
    # puts "@scope=#{@scope}"
    puts "For @name=#{@name} @signal=#{@signal}"
    @signal = @scope.make_inners(expr.type,@name) unless @signal
    # Performs the assignment.
    @signal <= expr
end

#to_exprObject

Converts to an expression.



51
52
53
# File 'lib/HDLRuby/std/pipeline.rb', line 51

def to_expr
    return @signal.to_expr
end

#to_refObject

Converts to a reference.



56
57
58
# File 'lib/HDLRuby/std/pipeline.rb', line 56

def to_ref
    return @signal.to_ref
end