Class: HDLRuby::High::SignalC
- Inherits:
-
Low::SignalC
- Object
- Base::SignalI
- Low::SignalI
- Low::SignalC
- HDLRuby::High::SignalC
- Includes:
- HRef
- Defined in:
- lib/HDLRuby/hruby_high.rb
Overview
Describes a high-level constant signal.
Constant Summary collapse
- High =
HDLRuby::High
Constants included from Low::Low2Symbol
Low::Low2Symbol::Low2SymbolPrefix, Low::Low2Symbol::Low2SymbolTable, Low::Low2Symbol::Symbol2LowTable
Instance Attribute Summary
Attributes inherited from Low::SignalI
Attributes included from HDLRuby::Hdecorator
Attributes included from Low::Hparent
Instance Method Summary collapse
-
#coerce(obj) ⇒ Object
Coerce by converting signal to an expression.
-
#initialize(name, type, value) ⇒ SignalC
constructor
Creates a new constant signal named +name+ typed as +type+ and +value+.
-
#to_expr ⇒ Object
Converts to a new expression.
-
#to_low(name = self.name) ⇒ Object
Converts the system to HDLRuby::Low and set its +name+.
-
#to_ref ⇒ Object
Converts to a new reference.
Methods included from HRef
Methods inherited from Low::SignalI
#clone, #each_deep, #eql?, #explicit_types!, #hash, #replace_names!, #set_name!, #set_type!, #set_value!, #to_c, #to_c_signal, #to_ch, #to_high, #to_verilog, #to_vhdl, #width
Methods included from Low::Low2Symbol
Methods included from HDLRuby::Hdecorator
decorate_parent_id, dump, each, each_with_property, get, included, load, #properties
Methods included from Low::Hparent
Constructor Details
#initialize(name, type, value) ⇒ SignalC
Creates a new constant signal named +name+ typed as +type+ and +value+.
3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 |
# File 'lib/HDLRuby/hruby_high.rb', line 3358 def initialize(name,type,value) # Check the value is a constant. value = value.to_expr unless value.constant? then raise AnyError,"Non-constant value assignment to constant." end # Initialize the type structure. super(name,type,value) unless name.empty? then # Named signal, set the hdl-like access to the signal. obj = self # For using the right self within the proc High.space_reg(name) { obj } end # Hierarchical type allows access to sub references, so generate # the corresponding methods. if type.struct? then type.each_name do |name| self.define_singleton_method(name) do RefObject.new(self.to_ref, SignalC.new(name,type.get_type(name), value[name])) end end end end |
Instance Method Details
#coerce(obj) ⇒ Object
Coerce by converting signal to an expression.
3397 3398 3399 |
# File 'lib/HDLRuby/hruby_high.rb', line 3397 def coerce(obj) return [obj,self.to_expr] end |
#to_expr ⇒ Object
Converts to a new expression.
3392 3393 3394 |
# File 'lib/HDLRuby/hruby_high.rb', line 3392 def to_expr return self.to_ref end |
#to_low(name = self.name) ⇒ Object
Converts the system to HDLRuby::Low and set its +name+.
3402 3403 3404 3405 3406 3407 3408 3409 3410 |
# File 'lib/HDLRuby/hruby_high.rb', line 3402 def to_low(name = self.name) # return HDLRuby::Low::SignalC.new(name,self.type.to_low, # self.value.to_low) signalCL = HDLRuby::Low::SignalC.new(name,self.type.to_low, self.value.to_low) # For debugging: set the source high object signalCL.properties[:low2high] = self.hdr_id return signalCL end |
#to_ref ⇒ Object
Converts to a new reference.
3387 3388 3389 |
# File 'lib/HDLRuby/hruby_high.rb', line 3387 def to_ref return RefObject.new(this,self) end |