This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Awaitable, Generic, TypeVar | |
from cocotb.triggers import Event | |
T = TypeVar("T") | |
class Signal(Generic[T]): | |
def __init__(self, __init_value: T) -> None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import deque | |
from typing import Deque, Generic, Optional, TypeVar | |
from cocotb.triggers import Event | |
T = TypeVar("T") | |
class RecvFailed(Exception): | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import * | |
K_contra = TypeVar("K_contra", contravariant=True) | |
K_co = TypeVar("K_co", covariant=True) | |
V_co = TypeVar("V_co", covariant=True) | |
V = TypeVar("V") | |
T = TypeVar("T") | |
class ContravariantMapping(Protocol[K_contra, V_co]): | |
def __getitem__(self, __key: K_contra) -> V_co: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- package containing a type-generic D Flip Flop | |
-- may not be 100% valid VHDL code, contact ktbarrett on gitter | |
-- non-generic version does synthesize correctly | |
package generic_pkg is | |
procedure generic_FF | |
generic ( | |
constant T: type) | |
paramater ( | |
signal q : out T; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* simulator control (enums or separate functions?) | |
* SHUTDOWN | |
* RESTART (new addition) | |
* logging | |
* levels | |
* TRACE | |
* DEBUG | |
* INFO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Awaitable | |
from cocotb.triggers import Trigger, _Event | |
class Alert(Awaitable[None]): | |
def __init__(self) -> None: | |
self._pending = [] | |
def set(self) -> None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from abc import ABCMeta, abstractmethod, abstractproperty | |
from asyncio import QueueEmpty | |
from collections import deque | |
from typing import ( | |
Callable, | |
Deque, | |
Generic, | |
Protocol, | |
Set, | |
Type, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdnoreturn.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
typedef enum { | |
PUSH, | |
POP, | |
ADD, | |
SUB, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def build_table( | |
field_spec: List[Tuple[str, str, Optional[int]]], | |
table: List[Dict[str, str]], | |
) -> str: | |
field_fmts = [] | |
sep_line_fields = [] | |
field_names = [] | |
for name, alignment, width in field_spec: | |
if width is None: | |
width = max(len(name), *(len(row[name]) for row in table)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from asyncio import QueueEmpty, QueueFull | |
from typing import Deque, Generic, TypeVar | |
from cocotb.triggers import Event | |
T = TypeVar("T") | |
class SendFailed(QueueFull): | |
... |