Class: HDLRuby::High::SignalI
- Inherits:
-
Low::SignalI
- Object
- Base::SignalI
- Low::SignalI
- HDLRuby::High::SignalI
- Includes:
- HRef
- Defined in:
- lib/HDLRuby/hruby_high.rb
Overview
Describes a high-level signal.
Constant Summary collapse
Constants included from Low::Low2Symbol
Low::Low2Symbol::Low2SymbolPrefix, Low::Low2Symbol::Low2SymbolTable, Low::Low2Symbol::Symbol2LowTable
Instance Attribute Summary collapse
-
#can_read ⇒ Object
Tells if the signal can be read.
-
#can_write ⇒ Object
Tells if the signal can be written.
-
#dir ⇒ Object
The bounding direction.
Attributes inherited from Low::SignalI
Attributes included from Low::Hparent
Instance Method Summary collapse
-
#coerce(obj) ⇒ Object
Coerce by converting signal to an expression.
-
#edge ⇒ Object
Creates an edge event from the signal.
-
#initialize(name, type, dir, value = nil) ⇒ SignalI
constructor
Creates a new signal named +name+ typed as +type+ with +dir+ as bounding direction and possible +value+.
-
#negedge ⇒ Object
Creates a negative edge event from the signal.
-
#posedge ⇒ Object
Creates a positive edge event from the signal.
-
#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, #immutable?, #replace_names!, #set_name!, #set_type!, #set_value!, #to_c, #to_c_alias, #to_c_signal, #to_ch, #to_hdr, #to_high, #to_verilog, #to_vhdl, #width
Methods included from Low::Low2Symbol
Methods included from Low::Hparent
Constructor Details
#initialize(name, type, dir, value = nil) ⇒ SignalI
Creates a new signal named +name+ typed as +type+ with +dir+ as bounding direction and possible +value+.
NOTE: +dir+ can be :input, :output, :inout or :inner
3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 |
# File 'lib/HDLRuby/hruby_high.rb', line 3683 def initialize(name,type,dir,value = nil) # Check the value. value = value.to_expr.match_type(type) if value # 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, SignalI.new(name,type.get_type(name),dir)) end end end # Check and set the bound. self.dir = dir # Set the read and write authorisations. @can_read = 1.to_expr @can_write = 1.to_expr end |
Instance Attribute Details
#can_read ⇒ Object
Tells if the signal can be read.
3674 3675 3676 |
# File 'lib/HDLRuby/hruby_high.rb', line 3674 def can_read @can_read end |
#can_write ⇒ Object
Tells if the signal can be written.
3677 3678 3679 |
# File 'lib/HDLRuby/hruby_high.rb', line 3677 def can_write @can_write end |
#dir ⇒ Object
The bounding direction.
3671 3672 3673 |
# File 'lib/HDLRuby/hruby_high.rb', line 3671 def dir @dir end |
Instance Method Details
#coerce(obj) ⇒ Object
Coerce by converting signal to an expression.
3758 3759 3760 |
# File 'lib/HDLRuby/hruby_high.rb', line 3758 def coerce(obj) return [obj,self.to_expr] end |
#edge ⇒ Object
Creates an edge event from the signal.
3743 3744 3745 |
# File 'lib/HDLRuby/hruby_high.rb', line 3743 def edge return Event.new(:edge,self.to_ref) end |
#negedge ⇒ Object
Creates a negative edge event from the signal.
3738 3739 3740 |
# File 'lib/HDLRuby/hruby_high.rb', line 3738 def negedge return Event.new(:negedge,self.to_ref) end |
#posedge ⇒ Object
Creates a positive edge event from the signal.
3733 3734 3735 |
# File 'lib/HDLRuby/hruby_high.rb', line 3733 def posedge return Event.new(:posedge,self.to_ref) end |
#to_expr ⇒ Object
Converts to a new expression.
3753 3754 3755 |
# File 'lib/HDLRuby/hruby_high.rb', line 3753 def to_expr return self.to_ref end |
#to_low(name = self.name) ⇒ Object
Converts the system to HDLRuby::Low and set its +name+.
3763 3764 3765 3766 3767 3768 3769 3770 3771 |
# File 'lib/HDLRuby/hruby_high.rb', line 3763 def to_low(name = self.name) # return HDLRuby::Low::SignalI.new(name,self.type.to_low) valueL = self.value ? self.value.to_low : nil signalIL = HDLRuby::Low::SignalI.new(name,self.type.to_low,valueL) # # For debugging: set the source high object # signalIL.properties[:low2high] = self.hdr_id # self.properties[:high2low] = signalIL return signalIL end |