Skip to content

Commit

Permalink
Faster Wishbone (kuznia-rdzeni/coreblocks#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
tilk authored Nov 13, 2023
1 parent c537152 commit 4b82429
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions transactron/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class RelationBase(TypedDict):
end: TransactionOrMethod
priority: Priority
conflict: bool
silence_warning: bool


class Relation(RelationBase):
Expand Down Expand Up @@ -271,7 +272,7 @@ def add_edge(begin: Transaction, end: Transaction, priority: Priority, conflict:
start = relation["start"]
end = relation["end"]
if not relation["conflict"]: # relation added with schedule_before
if end.def_order < start.def_order:
if end.def_order < start.def_order and not relation["silence_warning"]:
raise RuntimeError(f"{start.name!r} scheduled before {end.name!r}, but defined afterwards")

for trans_start in method_map.transactions_for(start):
Expand Down Expand Up @@ -714,7 +715,9 @@ def add_conflict(self, end: TransactionOrMethod, priority: Priority = Priority.U
Is one of conflicting `Transaction`\\s or `Method`\\s prioritized?
Defaults to undefined priority relation.
"""
self.relations.append(RelationBase(end=end, priority=priority, conflict=True))
self.relations.append(
RelationBase(end=end, priority=priority, conflict=True, silence_warning=self.owner != end.owner)
)

def schedule_before(self, end: TransactionOrMethod) -> None:
"""Adds a priority relation.
Expand All @@ -728,7 +731,9 @@ def schedule_before(self, end: TransactionOrMethod) -> None:
end: Transaction or Method
The other `Transaction` or `Method`
"""
self.relations.append(RelationBase(end=end, priority=Priority.LEFT, conflict=False))
self.relations.append(
RelationBase(end=end, priority=Priority.LEFT, conflict=False, silence_warning=self.owner != end.owner)
)

def use_method(self, method: "Method", arg: ValueLike, enable: ValueLike):
if method in self.method_uses:
Expand Down

0 comments on commit 4b82429

Please sign in to comment.