Adds for splitter
This commit is contained in:
parent
c037d5b5e3
commit
718bcb41e5
@ -7,3 +7,4 @@ require_relative "rcircuit/or.rb"
|
||||
require_relative "rcircuit/xor.rb"
|
||||
require_relative "rcircuit/adder.rb"
|
||||
require_relative "rcircuit/vcd.rb"
|
||||
require_relative "rcircuit/splitter.rb"
|
||||
|
@ -105,6 +105,17 @@ class Port
|
||||
def !
|
||||
return NotGate.new(self).out
|
||||
end
|
||||
|
||||
def [](*args)
|
||||
if args.length == 1
|
||||
#single bit or range
|
||||
bits = args[0]
|
||||
else
|
||||
#an array of bits, passed as multiple arguments
|
||||
bits = args
|
||||
end
|
||||
return Splitter.new(self, bits).out
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user