class HDLRuby::High::SignalI
Describes a high-level signal.
Constants
- DIRS
The valid bounding directions.
- High
High-level libraries for describing digital hardware.
Attributes
Tells if the signal can be read.
Tells if the signal can be written.
The bounding direction.
Public Class Methods
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
HDLRuby::Low::SignalI::new
# File lib/HDLRuby/hruby_high.rb, line 3407 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
Public Instance Methods
Sets the condition
when the signal can be read.
# File lib/HDLRuby/hruby_high.rb, line 3439 def can_read=(condition) @can_read = condition.to_expr end
Sets the condition
when the signal can be write.
# File lib/HDLRuby/hruby_high.rb, line 3444 def can_write=(condition) @can_write = condition.to_expr end
Coerce by converting signal to an expression.
# File lib/HDLRuby/hruby_high.rb, line 3482 def coerce(obj) return [obj,self.to_expr] end
Sets the direction to dir
.
# File lib/HDLRuby/hruby_high.rb, line 3449 def dir=(dir) unless DIRS.include?(dir) then raise AnyError, "Invalid bounding for signal #{self.name} direction: #{dir}." end @dir = dir end
Creates an edge event from the signal.
# File lib/HDLRuby/hruby_high.rb, line 3467 def edge return Event.new(:edge,self.to_ref) end
Creates a negative edge event from the signal.
# File lib/HDLRuby/hruby_high.rb, line 3462 def negedge return Event.new(:negedge,self.to_ref) end
Creates a positive edge event from the signal.
# File lib/HDLRuby/hruby_high.rb, line 3457 def posedge return Event.new(:posedge,self.to_ref) end
Converts to a new expression.
# File lib/HDLRuby/hruby_high.rb, line 3477 def to_expr return self.to_ref end
Converts the system to HDLRuby::Low
and set its name
.
# File lib/HDLRuby/hruby_high.rb, line 3487 def to_low(name = self.name) # return HDLRuby::Low::SignalI.new(name,self.type.to_low) signalIL = HDLRuby::Low::SignalI.new(name,self.type.to_low) # For debugging: set the source high object signalIL.properties[:low2high] = self.hdr_id self.properties[:high2low] = signalIL return signalIL end
Converts to a new reference.
# File lib/HDLRuby/hruby_high.rb, line 3472 def to_ref return RefObject.new(this,self) end