module HDLRuby::High::Std::HchannelI
Module giving the methods for accessing a channel instance.
Public Instance Methods
read(*args,&ruby_block)
click to toggle source
Performs a read on the channel using args
and ruby_block
as arguments. NOTE:
-
Will generate a port if not present.
-
Will generate an error if a read is tempted while the read port has been declared within another system.
# File lib/HDLRuby/std/channel.rb, line 337 def read(*args,&ruby_block) # Is there a port to read? unless self.read_port then # No, generate a new one. # Is it possible to be inout? if self.inout? then # Yes, create an inout port. self.inout(HDLRuby.uniq_name) else # No, create an input port. self.input(HDLRuby.uniq_name) end end # Ensure the read port is within current system. unless self.read_port.scope.system != HDLRuby::High.cur_system then raise "Cannot read from a port external of current system for channel " + self.name end # Performs the read. self.read_port.read(*args,&ruby_block) end
reset(*args,&ruby_block)
click to toggle source
Performs a reset on the channel using args
and ruby_block
as arguments.
# File lib/HDLRuby/std/channel.rb, line 388 def reset(*args,&ruby_block) # Gain access to the writer as local variable. reseter_proc = @inout_reseter_proc # # The context is the one of the writer. # Execute the code generating the writer in context. HDLRuby::High.space_push(@namespace) HDLRuby::High.cur_block.open do instance_exec(ruby_block,*args,&reseter_proc) end HDLRuby::High.space_pop end
wrap(*args)
click to toggle source
Wrap with args
arguments.
# File lib/HDLRuby/std/channel.rb, line 402 def wrap(*args) return ChannelB.new(self,*args) end
write(*args,&ruby_block)
click to toggle source
Performs a write on the channel using args
and ruby_block
as arguments. NOTE:
-
Will generate a port if not present.
-
Will generate an error if a read is tempted while the read port has been declared within another system.
# File lib/HDLRuby/std/channel.rb, line 364 def write(*args,&ruby_block) # Is there a port to write? unless self.write_port then # No, generate a new one. # Is it possible to be inout? if self.inout? then # Yes, create an inout port. self.inout(HDLRuby.uniq_name) else # No, create an output port. self.output(HDLRuby.uniq_name) end end # Ensure the write port is within current system. unless self.write_port.scope.system != HDLRuby::High.cur_system then raise "Cannot write from a port external of current system for channel " + self.name end # Performs the write. self.write_port.write(*args,&ruby_block) end