class HDLRuby::High::Std::ChannelB
Describes channel instance wrapper (Box) for fixing arugments.
Public Class Methods
Create a new channel box over channelI
channel instance using args
for fixing the arguments as follows: It can also be three lists for seperate read, write and access procedures using named arguments as: read: <read arguments>, write: <write arguments>, access: <access arguments>
# File lib/HDLRuby/std/channel.rb, line 1215 def initialize(channelI,*args) # Ensure port is a channel port. unless channelI.is_a?(ChannelI) || channel.is_a?(ChannelB) raise "Invalid class for a channel instance: #{ch.class}" end @channelI = channelI # Process the arguments. if args.size == 1 && args[0].is_a?(Hash) then # Read, write and access are separated. @args_read = args[0][:read] @args_write = args[0][:write] @args_access = args[0][:access] else @args_read = args @args_write = args.clone @args_access = args.clone end end
Public Instance Methods
Gets branch channel name
. NOTE:
* +name+ can be of any type on purpose. * The wrapping arguments are not transmitted to the branch.
# File lib/HDLRuby/std/channel.rb, line 1268 def branch(name,*args) return @channelI.branch(name,*args) end
Declares the accesser port and assigned them to name
.
# File lib/HDLRuby/std/channel.rb, line 1330 def inout(name = nil) # Ensure name is a symbol. name = HDLRuby.uniq_name unless name name = name.to_sym # Ensure the port is not already existing. if @read_port then raise "Read port already declared for channel instance: " + self.name end if @write_port then raise "Write port already declared for channel instance: " + self.name end # Create a write port for the encaspulted channel. if @channelI.read_port == @channelI.write_port then real_port = @channelI.read_port real_port = @channelI.inout unless real_port else raise "Inout port not supported for channel #{@channelI}" end # Wrap it to a new port using. chp = real_port.wrap(read: @args_read, write: @args_write) HDLRuby::High.space_reg(name) { chp } # Save the port in the channe to avoid conflicting declaration. @write_port = chp @read_port = chp return chp end
Tells if the channel support inout port.
# File lib/HDLRuby/std/channel.rb, line 1273 def inout? return @channelI.inout? end
Declares the reader port as and assigned them to name
.
# File lib/HDLRuby/std/channel.rb, line 1281 def input(name = nil) # Ensure name is a symbol. name = HDLRuby.uniq_name unless name name = name.to_sym # Ensure the port is not already existing. if @read_port then raise "Read port already declared for channel instance: " + self.name end # Create a read port for the encaspulted channel. real_port = @channelI.read_port real_port = @channelI.input unless real_port # Wrap it to a new port using. chp = real_port.wrap(read: @args_read) HDLRuby::High.space_reg(name) { chp } # Save the port in the channe to avoid conflicting declaration. @read_port = chp return chp end
The name of the channel instance.
# File lib/HDLRuby/std/channel.rb, line 1237 def name return @channelI.name end
The namespace associated with the current execution when building a channel.
# File lib/HDLRuby/std/channel.rb, line 1248 def namespace return @channelI.namespace end
Declares the ports for the writer and assigned them to name
.
# File lib/HDLRuby/std/channel.rb, line 1305 def output(name = nil) # Ensure name is a symbol. name = HDLRuby.uniq_name unless name name = name.to_sym # Ensure the port is not already existing. if @write_port then raise "Read port already declared for channel instance: " + self.name end # Create a write port for the encaspulted channel. real_port = @channelI.write_port real_port = @channelI.output unless real_port # Wrap it to a new port using. chp = real_port.wrap(write: @args_write) HDLRuby::High.space_reg(name) { chp } # Save the port in the channe to avoid conflicting declaration. @write_port = chp return chp end
The read port if any.
# File lib/HDLRuby/std/channel.rb, line 1253 def read_port return @read_port end
The scope the channel has been created in.
# File lib/HDLRuby/std/channel.rb, line 1242 def scope return @channelI.scope end
The write port if any.
# File lib/HDLRuby/std/channel.rb, line 1258 def write_port return @write_port end