Class: HDLRuby::High::Event
- Inherits:
-
Low::Event
- Object
- Low::Event
- HDLRuby::High::Event
- Defined in:
- lib/HDLRuby/hruby_high.rb,
lib/HDLRuby/hruby_rsim.rb,
lib/HDLRuby/std/clocks.rb,
lib/HDLRuby/hruby_rcsim.rb
Overview
Describes an event.
Constant Summary
Constants included from Low::Low2Symbol
Low::Low2Symbol::Low2SymbolPrefix, Low::Low2Symbol::Low2SymbolTable, Low::Low2Symbol::Symbol2LowTable
Instance Attribute Summary collapse
-
#rcevent ⇒ Object
readonly
Extends the Event class for hybrid Ruby-C simulation.
Attributes inherited from Low::Event
Attributes included from Low::Hparent
Instance Method Summary collapse
-
#*(times) ⇒ Object
Creates a new event activated every
timesoccurences of the current event. -
#invert ⇒ Object
Inverts the event: create a negedge if posedge, a posedge if negedge.
-
#to_event ⇒ Object
Converts to a new event.
-
#to_low ⇒ Object
Converts the event to HDLRuby::Low.
-
#to_rcsim(rcowner) ⇒ Object
Generate the C description of the event comming from object whose C description is
rcowner.
Methods inherited from Low::Event
#each_deep, #eql?, #get_signal_splits, #hash, #initialize, #on_edge?, #reassign_expressions!, #set_ref!, #set_type!, #to_c, #to_hdr, #to_high
Methods included from Low::Low2Symbol
Methods included from Low::Hparent
#absolute_ref, #hierarchy, #no_parent!, #scope
Constructor Details
This class inherits a constructor from HDLRuby::Low::Event
Instance Attribute Details
#rcevent ⇒ Object (readonly)
Extends the Event class for hybrid Ruby-C simulation.
409 410 411 |
# File 'lib/HDLRuby/hruby_rcsim.rb', line 409 def rcevent @rcevent end |
Instance Method Details
#*(times) ⇒ Object
Creates a new event activated every times occurences of the
current event.
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/HDLRuby/std/clocks.rb', line 211 def *(times) # The event must be an edge unless (self.type == :posedge or self.type == :negedge) then raise "Only posedge or negedge events can be multiplied." end # +times+ must be a value. times = times.to_value # Creates the clock for the new event. clock = nil # There are two cases: times is even or times is odd. if times.even? then # Even case: make a clock inverted every times/2 occurance of # current event. clock = HDLRuby::High::Std::make_clock(self,times/2) else # Odd case: make a clock raised every times occurance using # both event and inverted event clock = HDLRuby::High::Std::make_2edge_clock(self,times) end # Use the clock to create the new event. return clock.posedge end |
#invert ⇒ Object
Inverts the event: create a negedge if posedge, a posedge if negedge.
NOTE: raise an execption if the event is neigther pos nor neg edge.
4029 4030 4031 4032 4033 4034 4035 4036 4037 |
# File 'lib/HDLRuby/hruby_high.rb', line 4029 def invert if self.type == :posedge then return Event.new(:negedge,self.ref.to_ref) elsif self.type == :negedge then return Event.new(:posedge,self.ref.to_ref) else raise AnyError, "Event cannot be inverted: #{self.type}" end end |
#to_event ⇒ Object
Converts to a new event.
4022 4023 4024 |
# File 'lib/HDLRuby/hruby_high.rb', line 4022 def to_event return Event.new(self.type,self.ref.to_ref) end |
#to_low ⇒ Object
Converts the event to HDLRuby::Low.
4040 4041 4042 4043 4044 4045 4046 4047 |
# File 'lib/HDLRuby/hruby_high.rb', line 4040 def to_low # return HDLRuby::Low::Event.new(self.type,self.ref.to_low) eventL = HDLRuby::Low::Event.new(self.type,self.ref.to_low) # # For debugging: set the source high object # eventL.properties[:low2high] = self.hdr_id # self.properties[:high2low] = eventL return eventL end |
#to_rcsim(rcowner) ⇒ Object
Generate the C description of the event comming from object
whose C description is rcowner
413 414 415 416 417 418 419 420 421 |
# File 'lib/HDLRuby/hruby_rcsim.rb', line 413 def to_rcsim(rcowner) # Create the event C object. @rcevent = RCSim.rcsim_make_event(self.type,self.ref.to_rcsim) # Set the owner. RCSim.rcsim_set_owner(@rcevent,rcowner) return @rcevent end |