[Pather / Tool] more unification work and fixes
This commit is contained in:
parent
8712398990
commit
f9611933ac
19 changed files with 1022 additions and 137 deletions
|
|
@ -6,7 +6,9 @@ import pytest
|
|||
import numpy
|
||||
from numpy import pi
|
||||
|
||||
from masque import MinimumStatus, Pather, PortPather, Library, Port, RouteError, RouteFailurePolicy
|
||||
from masque import (
|
||||
MinimumStatus, Pather, PortPather, Library, Port, RouteError, RouteFailurePolicy,
|
||||
)
|
||||
from masque.builder.planner import RoutePortContext, RoutingPlanner
|
||||
from masque.builder.planner.planner import NoLegalRouteError
|
||||
from masque.builder.tools import BendOffer, PathTool, RenderStep, StraightOffer, Tool, UOffer
|
||||
|
|
@ -510,6 +512,45 @@ def test_pather_positional_bound_requires_port_rotation() -> None:
|
|||
p.trace_to('A', None, x=-5)
|
||||
|
||||
|
||||
def test_pather_positional_bound_rejects_non_manhattan_rotation() -> None:
|
||||
tool = PathTool(layer='M1', width=1, ptype='wire')
|
||||
p = Pather(Library(), tools=tool, render='deferred')
|
||||
p.pattern.ports['A'] = Port((0, 0), rotation=pi / 4, ptype='wire')
|
||||
|
||||
with pytest.raises(BuildError, match='nearly Manhattan'):
|
||||
p.trace_to('A', None, p=-5)
|
||||
|
||||
|
||||
def test_pather_positional_bound_accepts_nearly_manhattan_rotation() -> None:
|
||||
tool = PathTool(layer='M1', width=1, ptype='wire')
|
||||
p = Pather(Library(), tools=tool, render='deferred')
|
||||
p.pattern.ports['A'] = Port((0, 0), rotation=1e-10, ptype='wire')
|
||||
|
||||
p.trace_to('A', None, x=-5)
|
||||
assert numpy.allclose(p.pattern.ports['A'].offset, (-5, -5e-10), atol=1e-8)
|
||||
|
||||
|
||||
def test_pather_bundle_position_bound_rejects_non_manhattan_rotation() -> None:
|
||||
tool = PathTool(layer='M1', width=1, ptype='wire')
|
||||
p = Pather(Library(), tools=tool, render='deferred')
|
||||
p.pattern.ports['A'] = Port((0, 0), rotation=pi / 4, ptype='wire')
|
||||
p.pattern.ports['B'] = Port((1, 1), rotation=pi / 4, ptype='wire')
|
||||
|
||||
with pytest.raises(BuildError, match='nearly Manhattan'):
|
||||
p.trace(['A', 'B'], None, pmin=-5)
|
||||
|
||||
|
||||
def test_pather_bundle_extension_bound_allows_non_manhattan_rotation() -> None:
|
||||
tool = PathTool(layer='M1', width=1, ptype='wire')
|
||||
p = Pather(Library(), tools=tool, render='deferred')
|
||||
p.pattern.ports['A'] = Port((0, 0), rotation=pi / 4, ptype='wire')
|
||||
p.pattern.ports['B'] = Port((1, 1), rotation=pi / 4, ptype='wire')
|
||||
|
||||
p.trace(['A', 'B'], None, emin=5)
|
||||
assert len(p._paths['A']) == 1
|
||||
assert len(p._paths['B']) == 1
|
||||
|
||||
|
||||
def test_pather_jog_omitted_length_uses_minimum_length_route() -> None:
|
||||
lib = Library()
|
||||
tool = PathTool(layer='M1', width=1, ptype='wire')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue