Skip to content

Instantly share code, notes, and snippets.

View jck's full-sized avatar

Keerthan Jaic jck

  • London, UK
View GitHub Profile
@harvimt
harvimt / metastruct.py
Last active December 19, 2015 14:49
Example metaclass implementation for Python 3 for the construct3 library
class CustomCollection():
def __init__(self):
super().__init__()
self.items = []
def __setitem__(self, key, value):
if key == '_':
self.items.append(value)
else:
self.items.append((key, value))
from random import randint
from myhdl import *
class MemPort:
def __init__(self,depth=128):
self.addr = Signal(modbv(0, min=0, max=depth))
self.wdata = Signal(intbv(0)[8:])
self.we = Signal(bool(0))
self.rdata = Signal(intbv(0)[8:])
def get_signals(self):