class HDLRuby::High::TimeBlock
Describes a timed block.
NOTE:
-
this is the only kind of block that can include time statements.
-
this kind of block is not synthesizable!
Constants
- High
High-level libraries for describing digital hardware.
Public Class Methods
new(type, name = :"", &ruby_block)
click to toggle source
Creates a new type
sort of block with possible name
and build it by executing ruby_block
.
Calls superclass method
# File lib/HDLRuby/hruby_high.rb, line 3805 def initialize(type, name = :"", &ruby_block) # Initialize the block. super(type,name) unless name.empty? then # Named block, set the hdl-like access to the block. obj = self # For using the right self within the proc High.space_reg(name) { obj } end # Creates the namespace. @namespace = Namespace.new(self) build(&ruby_block) end
Public Instance Methods
repeat(delay, mode = nil, &ruby_block)
click to toggle source
Adds a loop until delay
statement in the block in mode
whose loop content is built using ruby_block
.
# File lib/HDLRuby/hruby_high.rb, line 3828 def repeat(delay, mode = nil, &ruby_block) # Build the content block. content = High.make_block(mode,&ruby_block) # Create and add the statement. self.add_statement(TimeRepeat.new(content,delay)) end
to_low()
click to toggle source
Converts the time block to HDLRuby::Low
.
# File lib/HDLRuby/hruby_high.rb, line 3836 def to_low # Create the resulting block blockL = HDLRuby::Low::TimeBlock.new(self.mode) # For debugging: set the source high object blockL.properties[:low2high] = self.hdr_id self.properties[:high2low] = blockL # Add the inner signals self.each_inner { |inner| blockL.add_inner(inner.to_low) } # Add the statements self.each_statement do |statement| blockL.add_statement(statement.to_low) end # Return the resulting block return blockL end
wait(delay)
click to toggle source
Adds a wait delay
statement in the block.
# File lib/HDLRuby/hruby_high.rb, line 3822 def wait(delay) self.add_statement(TimeWait.new(delay)) end