Skip to content
Snippets Groups Projects
Commit 7acddf88 authored by Oscar Gustafsson's avatar Oscar Gustafsson :bicyclist:
Browse files

Add process classes

parent 173b9710
No related branches found
No related tags found
No related merge requests found
Pipeline #75023 passed
...@@ -350,6 +350,7 @@ class AbstractOperation(Operation, AbstractGraphComponent): ...@@ -350,6 +350,7 @@ class AbstractOperation(Operation, AbstractGraphComponent):
] = None, ] = None,
latency: Optional[int] = None, latency: Optional[int] = None,
latency_offsets: Optional[Dict[str, int]] = None, latency_offsets: Optional[Dict[str, int]] = None,
execution_time: Optional[int] = None
): ):
"""Construct an operation with the given input/output count. """Construct an operation with the given input/output count.
......
from typing import Dict, Int, List
from b_asic.operation import AbstractOperation
from b_asic.port import InputPort, OutputPort
class Process:
def __init__(self, start_time : Int, execution_time : Int):
self._start_time = start_time
self._execution_time = execution_time
def __lt__(self, other):
return self._start_time < other.start_time or (
self._start_time == other.start_time and self.execution_time > _execution_time)
@property
def start_time(self) -> Int:
return self._start_time
@property
def execution_time(self) -> Int:
return self._execution_time
class OperatorProcess(Process):
def __init__(self, start_time : Int, operation : AbstractOperation):
super().__init__(start_time, operation.execution_time)
self._operation = operation
class MemoryVariable(Process):
def __init__(self, write_time : Int, write_port : OutputPort, reads : Dict[InputPort, Int]):
self._read_ports, self._life_times = reads.values()
super().__init__(start_time=write_time, execution_time=max(self._life_times))
@property
def life_times(self) -> List[Int]:
return self._life_times
@property
def read_ports(self) -> List[InputPort]:
return self._read_ports
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment