workflow modification, bus indexing

This commit is contained in:
Vojta Mrazek 2023-02-22 09:52:06 +01:00
parent 35240abc63
commit 43b3d65463
3 changed files with 5 additions and 2 deletions

View File

@ -84,7 +84,7 @@ jobs:
needs: build needs: build
strategy: strategy:
matrix: matrix:
python-version: [ '3.6.x', '3.7.x', '3.8.x', '3.9.x', '3.10.0-rc.2' ] python-version: [ '3.6', '3.7', '3.8', '3.9', '3.10', '3.11' ]
name: Python ${{ matrix.python-version }} test name: Python ${{ matrix.python-version }} test
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -77,6 +77,9 @@ class Bus():
""" """
return self.bus[wire_index] return self.bus[wire_index]
def __getitem__(self, i):
return self.bus[i]
# Connecting output wire of the inner circuit component to desired position in the described circuit's output bus # Connecting output wire of the inner circuit component to desired position in the described circuit's output bus
def connect(self, bus_wire_index: int, inner_component_out_wire: Wire, inserted_wire_desired_index: int = -1): def connect(self, bus_wire_index: int, inner_component_out_wire: Wire, inserted_wire_desired_index: int = -1):
"""Connects given 'Wire' object to a 'bus_wire_index' within this bus. """Connects given 'Wire' object to a 'bus_wire_index' within this bus.

View File

@ -186,7 +186,7 @@ def test_direct():
self.b = Bus(prefix=b.prefix, wires_list=b.bus) self.b = Bus(prefix=b.prefix, wires_list=b.bus)
self.out = Bus(self.prefix+"_out", self.N+1) self.out = Bus(self.prefix+"_out", self.N+1)
a_0 = self.a.get_wire(0) a_0 = self.a[0]
b_0 = self.b.get_wire(0) b_0 = self.b.get_wire(0)
or_1 = OrGate(a_0, b_0, prefix=self.prefix+"_or"+str(self.get_instance_num(cls=OrGate)), parent_component=self) or_1 = OrGate(a_0, b_0, prefix=self.prefix+"_or"+str(self.get_instance_num(cls=OrGate)), parent_component=self)