Adds for splitter

This commit is contained in:
Charlie 2018-07-18 21:05:55 -07:00
parent c037d5b5e3
commit 718bcb41e5
2 changed files with 12 additions and 0 deletions

View File

@ -7,3 +7,4 @@ require_relative "rcircuit/or.rb"
require_relative "rcircuit/xor.rb" require_relative "rcircuit/xor.rb"
require_relative "rcircuit/adder.rb" require_relative "rcircuit/adder.rb"
require_relative "rcircuit/vcd.rb" require_relative "rcircuit/vcd.rb"
require_relative "rcircuit/splitter.rb"

View File

@ -106,6 +106,17 @@ class Port
return NotGate.new(self).out return NotGate.new(self).out
end 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 protected
# Used by connect when setting up bidirectional connection. # Used by connect when setting up bidirectional connection.