repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
sprout42/StarStruct
starstruct/elementbitfield.py
"""StarStruct element class.""" import struct import re from starstruct.element import register, Element from starstruct.modes import Mode from starstruct.bitfield import BitField from starstruct.packedbitfield import PackedBitField @register class ElementBitField(Element): """ The bitfield StarStruct eleme...
sprout42/StarStruct
starstruct/tests/test_elementbase.py
<reponame>sprout42/StarStruct #!/usr/bin/env python3 """Tests for the elementbase class""" import unittest from starstruct.elementbase import ElementBase # pylint: disable=line-too-long,invalid-name,no-self-use class TestElementBase(unittest.TestCase): """ElementBase module tests""" def test_valid(self): ...
sprout42/StarStruct
starstruct/elementconstant.py
<reponame>sprout42/StarStruct """ The constant element class for StarStruct To be used in the following way: .. code-block:: python ExampleMessage = Message('constant_message', [ ('regular', 'B'), # Two regular messages ('fill_in_later', 'H'), ('ending_sequence',...
sprout42/StarStruct
starstruct/elementpad.py
<filename>starstruct/elementpad.py """StarStruct element class.""" import struct import re from starstruct.element import register, Element from starstruct.modes import Mode @register class ElementPad(Element): """ The basic StarStruct element class. """ def __init__(self, field, mode=Mode.Native, ...
sprout42/StarStruct
starstruct/message.py
"""StarStruct class.""" import collections import struct import starstruct.modes from starstruct.element import Element from starstruct.startuple import StarTuple # pylint: disable=line-too-long class Message(object): """An object much like NamedTuple, but with additional formatting.""" # pylint: disable=t...
sprout42/StarStruct
starstruct/elementfixedpoint.py
"""StarStruct fixedpoint element class.""" # pylint: disable=line-too-long import re import struct import decimal from decimal import Decimal from starstruct.element import register, Element from starstruct.modes import Mode # TODO: I think we could probably just do most of this with struct.calcsize BITS_FORMAT = ...
sprout42/StarStruct
starstruct/tests/test_elementlength.py
#!/usr/bin/env python3 """Tests for the elementlength class""" import unittest from starstruct.elementlength import ElementLength # pylint: disable=line-too-long,invalid-name class TestElementLength(unittest.TestCase): """ElementLength module tests""" def test_valid(self): """Test field formats th...
sprout42/StarStruct
starstruct/tests/test_elementfixedpoint.py
#!/usr/bin/env python3 """Tests for the elementfixedpoint class""" import unittest from decimal import Decimal from starstruct.elementfixedpoint import ElementFixedPoint, get_fixed_bits from starstruct.message import Message from starstruct.modes import Mode # pylint: disable=no-self-use class TestElementFixedPoi...
sprout42/StarStruct
starstruct/tests/test_elementescaped.py
<reponame>sprout42/StarStruct """Tests for the starstruct class""" # import pytest from starstruct.message import Message # from starstruct.modes import Mode # pylint: disable=line-too-long,invalid-name class TestStarStruct: """StarStruct module tests""" Repeated = Message('Repeated', [ ('x', 'B'),...
sprout42/StarStruct
starstruct/bitfield.py
import re import functools class BitField(object): def __init__(self, enum): if not all(isinstance(member.value, int) for member in enum): msg = 'Enum {} members must have integer values'.format(repr(enum)) raise TypeError(msg) try: assert enum(0) ms...
sprout42/StarStruct
starstruct/tests/test_mode.py
<reponame>sprout42/StarStruct import pytest from starstruct import Mode def test_from_byte_order(): assert Mode.from_byteorder('little') == Mode.Little assert Mode.from_byteorder('big') == Mode.Big assert Mode.from_byteorder('native') == Mode.Native assert Mode.from_byteorder('network') == Mode.Netwo...
sprout42/StarStruct
starstruct/packedbitfield.py
import re import collections import functools import starstruct.bitfield class PackedBitField(object): """ A class that is used to bitwise pack/unpack one or more enumerations or bitfields to/from an integer value """ def __init__(self, *args): # Ensure that there are no duplicate enum or ...
sprout42/StarStruct
starstruct/tests/test_elementcallable.py
<filename>starstruct/tests/test_elementcallable.py<gh_stars>1-10 #!/usr/bin/env python3 """Tests for the starstruct class""" # import struct import unittest from binascii import crc32 import pytest from starstruct.message import Message # from starstruct.modes import Mode # pylint: disable=line-too-long,invalid-n...
sprout42/StarStruct
starstruct/elementlength.py
<reponame>sprout42/StarStruct<filename>starstruct/elementlength.py """StarStruct element class.""" import struct import re from starstruct.element import register, Element from starstruct.modes import Mode @register class ElementLength(Element): """ The length StarStruct element class. """ def __in...
sprout42/StarStruct
starstruct/__init__.py
"""Package for StarStruct.""" import importlib import glob import os import sys __project__ = 'StarStruct' __version__ = '0.9.1' VERSION = __project__ + '-' + __version__ PYTHON_VERSION = 3, 5 if not sys.version_info >= PYTHON_VERSION: # pragma: no cover (manual test) exit("Python {}.{}+ is required.".format(...
sprout42/StarStruct
starstruct/tests/test_elementnone.py
<reponame>sprout42/StarStruct<gh_stars>1-10 #!/usr/bin/env python3 """Tests for the starstruct class""" import struct import unittest from hashlib import md5 from starstruct.message import Message class TestStarStructNone(unittest.TestCase): """StarStruct module tests""" # TODO: Clean up these tests, chang...
sprout42/StarStruct
starstruct/tests/test_elementvariable.py
<reponame>sprout42/StarStruct #!/usr/bin/env python3 """Tests for the starstruct class""" import enum import struct import unittest import pytest from starstruct.message import Message # from starstruct.modes import Mode class SimpleEnum(enum.Enum): """Simple enum class for testing message pack/unpack""" ...
sprout42/StarStruct
starstruct/tests/test_elementstring.py
#!/usr/bin/env python3 """Tests for the elementstring class""" import unittest import pytest from starstruct.message import Message from starstruct.elementstring import ElementString # pylint: disable=line-too-long,invalid-name class TestElementString(unittest.TestCase): """ElementString module tests""" ...
sprout42/StarStruct
starstruct/startuple.py
<reponame>sprout42/StarStruct import collections def StarTuple(name, named_fields, elements): restricted_fields = { # Default dunders '__getnewargs__', '__new__', '__slots__ ', '__repr__', # Default #oneders '_asdict', '_make', '_replace', ...
sprout42/StarStruct
starstruct/tests/test_elementpad.py
#!/usr/bin/env python3 """Tests for the elementpad class""" import unittest from starstruct.elementpad import ElementPad # pylint: disable=line-too-long,invalid-name class TestElementPad(unittest.TestCase): """ElementPad module tests""" def test_valid(self): """Test field formats that are valid El...
sprout42/StarStruct
starstruct/elementvariable.py
<gh_stars>1-10 """ The variable NamedStruct element class. Can be used in multiple ways ways: 1: Variable Lengths, in terms of namedstruct elements .. code-block:: python ExampleMessage = Message('VarTest', [('x', 'B'), ('y', 'B')]) message_struct = [ ('length_in_objects', 'H', 'vard...
sprout42/StarStruct
starstruct/tests/test_elementbitfield.py
#!/usr/bin/env python3 """Tests for the elementenum class""" import unittest import struct import enum from starstruct.bitfield import BitField from starstruct.packedbitfield import PackedBitField from starstruct.elementbitfield import ElementBitField class SimpleEnum(enum.Enum): """Simple enum class for testi...
NumericalMax/Dashboard
Dashboard/main.py
<gh_stars>10-100 # Author: <NAME> # Created on: 31.10.2017 # Purpose: Simple Example of how to use bootstrap template and PivotTable in order to build a small Dashboard collecting data from a SQL DB. # License: License Files can be found in the root folder 'Dashboard' # The Code is mainly based on implementation from ...
SergeyShurkhovetckii/Best-Current_Python_telegram_bot
bot.py
<reponame>SergeyShurkhovetckii/Best-Current_Python_telegram_bot<filename>bot.py import config #Конфинурация для Telegram Bot import requests # Модуль для обработки URL from bs4 import BeautifulSoup as BS # Модуль для работы с HTML import time # Модуль для остановки программы import telebot import emoji #Смайлики from...
SergeyShurkhovetckii/Best-Current_Python_telegram_bot
config.py
<filename>config.py token = "<KEY>"
jacobq/csci5221-viro-project
ext/viro_constant.py
# Manually set L L = 4 # OpenFlow Ethernet Frame type codes (dl_type) VIRO_DATA = 0x0802 # See ../pox/lib/packet/ethernet.py: VIRO_TYPE = 0x0802 VIRO_CONTROL = 0x0803 OP_NAMES = { 0x0000: 'VIRO_DATA_OP', 0x1000: 'RDV_PUBLISH', 0x2000: 'RDV_QUERY', 0x3000: 'RDV_REPLY', 0x4000: 'DISCOVERY_ECHO_...
jacobq/csci5221-viro-project
ext/viro_controller.py
# Copyright 2011 <NAME> # # This file is part of POX. # # POX is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # POX is distributed in...
jacobq/csci5221-viro-project
ext/viro_module.py
<reponame>jacobq/csci5221-viro-project import socket, struct, sys, time, random from viro_veil import * class ViroModule(object): def __init__(self, my_dpid, my_vid): self.dpid = my_dpid self.vid = my_vid self.L = len(my_vid) self.neighbors = {} self.rdv_store = {} ...
jacobq/csci5221-viro-project
ext/viro_veil.py
import socket, struct, sys, random, traceback from viro_constant import * def get_dpid_length(dpid): dpid_bytes = dpid.split("-") return len(dpid_bytes) * 8 # convert a string containing mac address into a byte array def get_mac_array(mac): mac_array = [0] * 6 mac_bytes = mac.split("-") if len(ma...
jacobq/csci5221-viro-project
ext/viro_switch.py
import traceback import pox.openflow.libopenflow_01 as of from pox.lib.packet import * from pox.lib.addresses import * from viro_veil import * class ViroSwitch(object): def __init__(self, connection, transparent, viro_module): self.connection = connection self.transparent = transparent se...
addman2/KvantSim
Exercises/EX03-relax/Si/cellpar/plot.dist.py
<reponame>addman2/KvantSim #!/usr/bin/env python import os import numpy as np from matplotlib import pyplot as plt results = [] for d, dn, fn in os.walk("."): for dir in sorted(dn): if "scf-" in dir: try: E = 0 with open(d+"/"+dir+"/scf.out") as f: ...
addman2/KvantSim
Exercises/bin/sdos.plot.py
<reponame>addman2/KvantSim #!/usr/bin/env python import sys import numpy as np from matplotlib import pyplot as plt E, Ndown, Nup = np.loadtxt(sys.argv[1], usecols = (0,1,2), unpack = True) plt.plot(E, -Ndown,label="down") plt.plot(E, Nup,label="up" ) try: plt.plot([float(sys.argv[2])] * 2, [max(Nup),-max(N...
addman2/KvantSim
Exercises/EX03-relax/CO/plotdist/run.dist.py
<gh_stars>0 #!/usr/bin/env python import os import numpy as np source = "CO.scf.in" min_a = 1.0 max_a = 1.2 stp_a = 15 run_cmd = "mpirun -np 1 pw.x < scf.in > scf.out" for a in np.linspace(min_a, max_a, stp_a): sa = "{:5.3f}".format(a) print("Calculating " + sa) wd = "scf-" + sa if not os.pat...
addman2/KvantSim
Exercises/EX01-Si_bulk/scf/conv-test/run.conv-test.py
#!/usr/bin/env python import os import numpy as np source = "si.scf.in" min_scf = 8 max_scf = 40 stp_scf = 24 run_cmd = "mpirun -np 1 pw.x < scf.in > scf.out" for scf in np.linspace(min_scf, max_scf, stp_scf): sscf = "{:5.3f}".format(scf) print("Calculating " + sscf) wd = "scf-" + sscf if not...
addman2/KvantSim
Exercises/bin/dos.plot.py
#!/usr/bin/env python import sys import numpy as np from matplotlib import pyplot as plt E, N = np.loadtxt(sys.argv[1], usecols = (0,1), unpack = True) plt.plot(E, N) try: plt.plot([float(sys.argv[2])] * 2, [max(N),0.0],"r-") except: pass plt.xlim([min(E),max(E)]) plt.ylim([0.0,max(N)]) plt.plot(plt.xlim(...
addman2/KvantSim
Exercises/EX02-Al_bulk/scf/conv-test/plot.conv-test.py
import os import numpy as np from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D results = [] for d, dn, fn in os.walk("."): for dir in sorted(dn): if "scf-" in dir: try: E = 0 with open(d+"/"+dir+"/scf.out") as f: f...
addman2/KvantSim
Exercises/EX02-Al_bulk/scf/conv-test/run.conv-test.py
import os import numpy as np source = "al.scf.in" CO_min = 18 CO_max = 20 CO_stp = 3 KP_min = 10 KP_max = 12 KP_stp = 3 for kp in np.linspace(KP_min, KP_max, KP_stp): kp = int(kp) for scf in np.linspace(CO_min, CO_max, CO_stp): print("Calculating " + str(scf)) print("Calculating KP = {:3d}"....
addman2/KvantSim
Beamer/kpath.py
from ase.io.espresso import read_espresso_in from ase.dft.kpoints import ibz_points from ase.dft.kpoints import get_bandpath xtal = read_espresso_in("x.scf.in") ip = ibz_points["cubic"] points = [ "Gamma", "X", "M", "Gamma"] path = [ip[p] for p in points] print(xtal.cell) kpts, x, X = get_bandpath(path, ...
addman2/KvantSim
Exercises/bin/bands.plot.py
<reponame>addman2/KvantSim<filename>Exercises/bin/bands.plot.py<gh_stars>0 #!/usr/bin/env python import sys import os import numpy as np from matplotlib import pyplot as plt bands = [] with open(os.getcwd()+"/"+sys.argv[1]) as f: for i, line in enumerate(f): if i%2 == 0: try: ...
akezhanmussa/SimulationCovidApp
main.py
import simulation import requests import pydantic import typing import yaml CONFIG_YAML = 'config.yaml' class SimulationConfig(pydantic.BaseModel): endpoint: str lat_range: typing.Tuple[float, float] lon_range: typing.Tuple[float, float] count: int class OauthConfig(pydantic.BaseModel): endpoint:...
akezhanmussa/SimulationCovidApp
simulation.py
<gh_stars>0 import requests import random import typing import json import logging back_url = None def set_api_host(host): global back_url if back_url is None: back_url = host def fetch_authoriztion_token( basic_auth: typing.Tuple[float, float], oauth: typing.Dict[str, str], endpoint: s...
brainmorsel/python-dhcp-sprout
ds/dhcp/server.py
import asyncio from enum import Enum import logging import socket from collections import defaultdict import ipaddress import time from datetime import datetime import aiopg from sqlalchemy.dialects import postgresql as pg import sqlalchemy as sa import psycopg2 from .proto.packet import Packet from .proto.opttypes i...
brainmorsel/python-dhcp-sprout
ds/web/views.py
import datetime from aiohttp import web from aiohttp_jinja2 import template import sqlalchemy as sa from sqlalchemy.dialects import postgresql as pg import psycopg2 from ds import db from . import forms @template('index.jinja2') async def index(request): return {} @template('profile_list.jinja2') async def pr...
brainmorsel/python-dhcp-sprout
ds/db/__init__.py
<filename>ds/db/__init__.py<gh_stars>0 import sys import ipaddress import asyncio from aiopg.sa import create_engine from sqlalchemy.dialects import postgresql as pg import sqlalchemy as sa import psycopg2.extensions metadata = sa.MetaData() def cast_inet(value, cur): if value is None: return None ...
brainmorsel/python-dhcp-sprout
ds/web/forms.py
<gh_stars>0 import ipaddress from wtforms import Form from wtforms import StringField from wtforms import TextAreaField from wtforms import validators from wtforms import ValidationError def str_to_ip_list(ip_list_str): if ip_list_str and isinstance(ip_list_str, str): return list(map(ipaddress.IPv4Addres...
brainmorsel/python-dhcp-sprout
ds/dhcp/proto/opttypes.py
from enum import IntEnum class OptionType(IntEnum): # RFC1497 vendor extensions Pad = 0 End = 255 SubnetMask = 1 TimeOffset = 2 Router = 3 TimeServer = 4 NameServer = 5 DomainNameServers = 6 LogServer = 7 CookieServer = 8 LPRServer = 9 ImpressServer = 10 Resourc...
brainmorsel/python-dhcp-sprout
ds/dhcp/bench.py
import logging import socket import threading import time from .proto.packet import Packet from .proto.opttypes import OptionType from .proto.dhcpmsg import MessageType def sync_worker(address, on_success, on_fail, oneshot=False, macaddr=None, relay_ip=None): sock = socket.socket(socket.AF_INET, socket.SOCK_DGR...
brainmorsel/python-dhcp-sprout
ds/dhcp/util.py
<filename>ds/dhcp/util.py<gh_stars>0 import binascii from collections import defaultdict def mac_to_string(addr_bytes): return ':'.join('%02x' % b for b in addr_bytes) _cleanup_table = defaultdict(lambda: None, {ord(c): c for c in '0123456789abcdefABCDEF'}) def mac_to_bytes(addr_string): return binascii.unh...
brainmorsel/python-dhcp-sprout
ds/web/server.py
<reponame>brainmorsel/python-dhcp-sprout import os import base64 import logging from aiohttp import web from aiohttp_session import session_middleware from aiohttp_session.cookie_storage import EncryptedCookieStorage from cryptography.fernet import Fernet import aiohttp_jinja2 import jinja2 from . import urls def r...
brainmorsel/python-dhcp-sprout
setup.py
<gh_stars>0 from setuptools import setup, find_packages setup( name='ds', version='0.1', packages=find_packages(), include_package_data=True, install_requires=[ 'click', 'uvloop', 'aiopg', 'psycopg2', 'sqlalchemy', 'aiohttp', 'aiohttp-jinja2',...
brainmorsel/python-dhcp-sprout
ds/cli.py
import sys import asyncio import logging.handlers import signal from configparser import ConfigParser import click import uvloop asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) import aiopg import psycopg2.extras import sqlalchemy as sa from sqlalchemy.dialects import postgresql as pg import aiopg.sa from . i...
brainmorsel/python-dhcp-sprout
ds/dhcp/proto/enc.py
<filename>ds/dhcp/proto/enc.py import struct import ipaddress ST_UINT32 = struct.Struct('!I') def default(buffer, offset, type_code, value:bytes): bytes_size = 2 + len(value) buffer[offset] = type_code buffer[offset + 1] = len(value) buffer[offset + 2:offset + bytes_size] = value return bytes_si...
brainmorsel/python-dhcp-sprout
ds/dhcp/proto/dec.py
from .dhcpmsg import MessageType from .opttypes import OptionType def default(buffer, offset): value_len = buffer[offset + 1] value = buffer[offset + 2:offset + 2 + value_len] size = 2 + value_len return value, size def pad(buffer, offset): return None, 1 def parameters_request_list(buffer, of...
brainmorsel/python-dhcp-sprout
ds/dhcp/proto/option.py
<gh_stars>0 from collections import defaultdict from . import dec from . import enc from .opttypes import OptionType from .opttypes import AgentInformationOptionType class Option: TYPE_ENUM = OptionType DECODERS = defaultdict(lambda: dec.default, { OptionType.Pad: dec.pad, OptionType.End: dec...
brainmorsel/python-dhcp-sprout
ds/dhcp/proto/packet.py
<gh_stars>0 import ipaddress import struct from enum import IntEnum from ..util import mac_to_string from ..util import mac_to_bytes from .option import Option from .option import AgentInformationSubOption from .opttypes import OptionType from .opttypes import AgentInformationOptionType from .dhcpmsg import MessageTyp...
brainmorsel/python-dhcp-sprout
ds/web/urls.py
<reponame>brainmorsel/python-dhcp-sprout<filename>ds/web/urls.py from . import views def configure(add): add('GET', '/', views.index) add('GET', '/profile/', views.profile_list) add('*', '/profile/new', views.profile_edit) add('*', '/profile/{id}/edit', views.profile_edit) add('*', '/pr...
brainmorsel/python-dhcp-sprout
ds/dhcp/proto/dhcpmsg.py
<reponame>brainmorsel/python-dhcp-sprout from enum import IntEnum class MessageType(IntEnum): DISCOVER = 1 OFFER = 2 REQUEST = 3 DECLINE = 4 ACK = 5 NAK = 6 RELEASE = 7 # rfc2132 INFORM = 8 # rfc4388 LEASEQUERY = 10 LEASEUNASSIGNED = 11 LEASEUNKNOWN = 12 LEASEA...
0dysseas/news-indicator
newsindicator/utils.py
import json import os def print_json_object(obj): """ A JSON print helper function. """ print ('Printing JSON object') print (json.dumps(obj, indent=4)) def get_asset(asset='sources'): """ Gets the assets from the specified folder. """ absolute_path = os.path.dirname(os.path.absp...
0dysseas/news-indicator
newsindicator/news_indicator.py
import sys import signal import logging import webbrowser from Queue import Queue from datetime import datetime import gi gi.require_version('Gtk', '3.0') gi.require_version('AppIndicator3', '0.1') import notify2 from gi.repository import Gtk, AppIndicator3, GObject from apscheduler.schedulers.background import Bloc...
0dysseas/news-indicator
newsindicator/__init__.py
#__version__ used as the starting point for SemVer __version__ = "2.6.3"
0dysseas/news-indicator
setup.py
<filename>setup.py #!/usr/bin/python # from distutils.core import setup from setuptools import setup # Package meta-data. NAME = 'newsindicator' DESCRIPTION = 'Linux app indicator that retrieves news from top media outlets' URL = 'https://github.com/0dysseas/news-indicator' REQUIRED = [ 'requests', 'APScheduler'...
0dysseas/news-indicator
newsindicator/about_and_settings_wins.py
import gi gi.require_version('Gtk', '3.0') gi.require_version('AppIndicator3', '0.1') from gi.repository import Gtk COMMENT = 'News Indicator is an appindicator that retrieves the latest news articles,' \ ' on a variety of topics from top media outlets.\n\n\nBuilt with Python and powered by NewsAPI.' # Ne...
0dysseas/news-indicator
newsindicator/tests/test_assert.py
import unittest class TestAssert(unittest.TestCase): def test_first(self): self.assertEqual('foo', 'foo') def test_second(self): self.assertEqual('bar', 'bar') def test_third(self): self.assertEqual('foobar', 'foobar') if __name__ == '__main__': unittest.main()
0dysseas/news-indicator
newsindicator/get_news.py
<filename>newsindicator/get_news.py import logging import os import sys from Queue import Queue from threading import Thread import gi gi.require_version('Gtk', '3.0') gi.require_version('AppIndicator3', '0.1') import requests import notify2 from utils import get_news_sources_from_file, delete_redundant_items NUM_...
hartono-wen/get-ip-address-with-python
main.py
<gh_stars>0 import requests # API Specification: http://ip-api.com/docs/api:json response = requests.get('http://ip-api.com/json') print("This computer's IP Address is {0}".format(response.json()['query'])) print("The timezone of the request origin location is {0}".format(response.json()['timezone'])) print("T...
Qone2/real-matzip-backend-detection-api-server
app.py
<reponame>Qone2/real-matzip-backend-detection-api-server import time from absl import app, logging import cv2 import numpy as np import tensorflow as tf from yolov3_tf2.models import ( YoloV3, YoloV3Tiny ) from yolov3_tf2.dataset import transform_images, load_tfrecord_dataset from yolov3_tf2.utils import draw_outpu...
StanfordAHA/garnet
global_buffer/design/glb_header.py
<reponame>StanfordAHA/garnet<gh_stars>10-100 from kratos import PackedStruct, clog2 from global_buffer.design.global_buffer_parameter import GlobalBufferParams import math class GlbHeader(): def __init__(self, _params: GlobalBufferParams): self._params = _params self.cfg_data_network_t = PackedSt...
StanfordAHA/garnet
global_buffer/design/glb_bank_ctrl.py
from kratos import Generator, always_comb, concat, const, always_ff, posedge from global_buffer.design.global_buffer_parameter import GlobalBufferParams from global_buffer.design.glb_cfg_ifc import GlbConfigInterface from global_buffer.design.glb_header import GlbHeader from global_buffer.design.pipeline import Pipelin...
StanfordAHA/garnet
global_buffer/design/glb_core_proc_router.py
<filename>global_buffer/design/glb_core_proc_router.py from kratos import Generator, always_ff, always_comb, posedge from global_buffer.design.global_buffer_parameter import GlobalBufferParams from global_buffer.design.glb_header import GlbHeader class GlbCoreProcRouter(Generator): def __init__(self, _params: Glo...
StanfordAHA/garnet
global_buffer/design/global_buffer.py
from kratos import Generator, always_ff, posedge, always_comb, clock_en, clog2, const, concat from kratos.util import to_magma from global_buffer.design.glb_tile import GlbTile from global_buffer.design.glb_cfg_ifc import GlbConfigInterface from global_buffer.design.global_buffer_parameter import GlobalBufferParams fro...
StanfordAHA/garnet
global_buffer/design/glb_cfg_ifc.py
from kratos import Interface class GlbConfigInterface(Interface): def __init__(self, addr_width: int, data_width: int): Interface.__init__(self, f"glb_cfg_ifc_A_{addr_width}_D_{data_width}") # Local variables self.wr_en = self.var("wr_en", 1) self.wr_addr = self.var("wr_addr", add...
StanfordAHA/garnet
mflowgen/Tile_MemCore/construct.py
<gh_stars>10-100 #! /usr/bin/env python #========================================================================= # construct.py #========================================================================= # Author : # Date : # import os import sys from mflowgen.components import Graph, Step from shutil import which...
StanfordAHA/garnet
mflowgen/glb_top/synopsys-ptpx-gl/parse_report.py
import argparse import pandas as pd import re def gen_power_df(filename: str, instances: list): power_columns = ['internal', 'switching', 'leakage', 'total'] power_df = pd.DataFrame(0.0, index=instances, columns=power_columns) with open(filename, 'r') as f: line_start = False for line in f...
StanfordAHA/garnet
global_buffer/design/glb_core_pcfg_dma.py
<filename>global_buffer/design/glb_core_pcfg_dma.py from kratos import Generator, always_ff, always_comb, posedge, const, clog2, resize from global_buffer.design.pipeline import Pipeline from global_buffer.design.global_buffer_parameter import GlobalBufferParams from global_buffer.design.glb_header import GlbHeader imp...
StanfordAHA/garnet
global_buffer/design/glb_bank_memory.py
from kratos import Generator, always_comb, concat, always_ff, posedge, const from global_buffer.design.global_buffer_parameter import GlobalBufferParams from global_buffer.design.pipeline import Pipeline from global_buffer.design.glb_bank_sram_gen import GlbBankSramGen from global_buffer.design.glb_bank_sram_stub impor...
StanfordAHA/garnet
global_buffer/design/glb_core_sram_cfg_ctrl.py
<gh_stars>10-100 from kratos import Generator, always_ff, always_comb, posedge from global_buffer.design.global_buffer_parameter import GlobalBufferParams from global_buffer.design.glb_cfg_ifc import GlbConfigInterface from global_buffer.design.glb_header import GlbHeader class GlbCoreSramCfgCtrl(Generator): def ...
StanfordAHA/garnet
global_buffer/gen_global_buffer_rdl.py
<gh_stars>10-100 from abc import ABC from kratos import clog2 import os class RdlNode(ABC): def __init__(self, name="", desc="", property=[]): self.name = name self._desc = desc self.property = property self.children = [] @property def desc(self): return self._desc...
StanfordAHA/garnet
global_buffer/design/pipeline.py
from kratos import Generator, always_ff, posedge, resize, clog2, const class Pipeline(Generator): def __init__(self, width: int, depth: int, flatten_output=False, reset_high=False): name_suffix = "" if flatten_output: name_suffix += "_array" if reset_high: name_suff...
StanfordAHA/garnet
global_buffer/design/glb_bank_sram_gen.py
<reponame>StanfordAHA/garnet from kratos import Generator, always_comb, concat, always_ff, posedge, const, resize from kratos.util import clog2 from global_buffer.design.TS1N16FFCLLSBLVTC2048X64M8SW import TS1N16FFCLLSBLVTC2048X64M8SW from global_buffer.design.pipeline import Pipeline from global_buffer.design.global_b...
StanfordAHA/garnet
global_buffer/global_buffer_main.py
<filename>global_buffer/global_buffer_main.py import argparse from global_buffer.design.global_buffer import GlobalBuffer from global_buffer.design.global_buffer_parameter import gen_global_buffer_params, gen_header_files from systemRDL.util import gen_rdl_header import os import pathlib import kratos as k def gen_pa...
StanfordAHA/garnet
global_buffer/design/glb_tile_pcfg_switch.py
<gh_stars>10-100 from kratos import Generator, always_ff, always_comb, posedge from global_buffer.design.global_buffer_parameter import GlobalBufferParams from global_buffer.design.glb_header import GlbHeader class GlbTilePcfgSwitch(Generator): def __init__(self, _params: GlobalBufferParams): super().__in...
StanfordAHA/garnet
global_buffer/design/glb_core_store_dma.py
from kratos import Generator, always_ff, always_comb, posedge, concat, const, resize, ext, clog2 from global_buffer.design.glb_loop_iter import GlbLoopIter from global_buffer.design.glb_sched_gen import GlbSchedGen from global_buffer.design.glb_addr_gen import GlbAddrGen from global_buffer.design.pipeline import Pipeli...
StanfordAHA/garnet
global_buffer/design/glb_sched_gen.py
from kratos import always_ff, always_comb, posedge, Generator, clog2 from global_buffer.design.global_buffer_parameter import GlobalBufferParams class GlbSchedGen(Generator): ''' Generate schedule ''' def __init__(self, _params: GlobalBufferParams): super().__init__(f"glb_sched_gen") self._pa...
StanfordAHA/garnet
global_buffer/design/glb_loop_iter.py
from kratos import Generator, clog2, always_ff, always_comb, posedge, const from global_buffer.design.global_buffer_parameter import GlobalBufferParams class GlbLoopIter(Generator): ''' Generate loop iteration ''' def __init__(self, _params: GlobalBufferParams): super().__init__(f"glb_loop_iter") ...
StanfordAHA/garnet
mflowgen/global_controller/construct.py
#! /usr/bin/env python #========================================================================= # construct.py #========================================================================= # Author : # Date : # import os import sys from mflowgen.components import Graph, Step from shutil import which def construct()...
StanfordAHA/garnet
global_buffer/design/glb_addr_gen.py
<reponame>StanfordAHA/garnet from kratos import always_ff, posedge, Generator, clog2 from global_buffer.design.global_buffer_parameter import GlobalBufferParams class GlbAddrGen(Generator): ''' Generate addresses ''' def __init__(self, _params: GlobalBufferParams): super().__init__(f"glb_addr_gen") ...
StanfordAHA/garnet
global_buffer/design/glb_core_switch.py
<reponame>StanfordAHA/garnet<gh_stars>10-100 from kratos import Generator, always_ff, always_comb, posedge, concat from global_buffer.design.global_buffer_parameter import GlobalBufferParams from global_buffer.design.glb_header import GlbHeader class GlbCoreSwitch(Generator): def __init__(self, _params: GlobalBuf...
StanfordAHA/garnet
global_buffer/design/glb_core_strm_mux.py
from kratos import Generator, always_ff, always_comb, posedge from global_buffer.design.global_buffer_parameter import GlobalBufferParams class GlbCoreStrmMux(Generator): def __init__(self, _params: GlobalBufferParams): super().__init__("glb_core_strm_mux") self._params = _params self.clk...
StanfordAHA/garnet
global_buffer/design/glb_core.py
<filename>global_buffer/design/glb_core.py from kratos import Generator from global_buffer.design.glb_core_pcfg_router import GlbCorePcfgRouter from global_buffer.design.glb_core_proc_router import GlbCoreProcRouter from global_buffer.design.glb_core_sram_cfg_ctrl import GlbCoreSramCfgCtrl from global_buffer.design.glb...
StanfordAHA/garnet
global_buffer/design/TS1N16FFCLLSBLVTC2048X64M8SW.py
from kratos import Generator, always_ff, posedge class TS1N16FFCLLSBLVTC2048X64M8SW(Generator): def __init__(self): super().__init__("TS1N16FFCLLSBLVTC2048X64M8SW") self.CLK = self.clock("CLK") self.CEB = self.input("CEB", 1) self.WEB = self.input("WEB", 1) self.BWEB = self...
StanfordAHA/garnet
global_buffer/design/glb_bank_sram_stub.py
<filename>global_buffer/design/glb_bank_sram_stub.py from kratos import Generator, always_ff, posedge, concat, const, resize, clog2 from global_buffer.design.TS1N16FFCLLSBLVTC2048X64M8SW import TS1N16FFCLLSBLVTC2048X64M8SW from global_buffer.design.pipeline import Pipeline from global_buffer.design.global_buffer_parame...
StanfordAHA/garnet
global_buffer/design/glb_tile_cfg_ctrl.py
from kratos import Generator, always_comb, always_ff, posedge from global_buffer.design.glb_cfg_ifc import GlbConfigInterface from global_buffer.design.global_buffer_parameter import GlobalBufferParams class GlbTileCfgCtrl(Generator): def __init__(self, _params: GlobalBufferParams): super().__init__("glb_...
StanfordAHA/garnet
global_buffer/design/glb_core_pcfg_router.py
<reponame>StanfordAHA/garnet<gh_stars>10-100 from kratos import Generator, always_ff, always_comb, posedge from global_buffer.design.global_buffer_parameter import GlobalBufferParams from global_buffer.design.glb_header import GlbHeader class GlbCorePcfgRouter(Generator): def __init__(self, _params: GlobalBufferP...
StanfordAHA/garnet
global_buffer/design/glb_bank.py
<reponame>StanfordAHA/garnet from kratos import Generator from global_buffer.design.glb_bank_memory import GlbBankMemory from global_buffer.design.glb_bank_ctrl import GlbBankCtrl from global_buffer.design.global_buffer_parameter import GlobalBufferParams from global_buffer.design.glb_cfg_ifc import GlbConfigInterface ...
StanfordAHA/garnet
cgra/ifc_struct.py
import magma class ProcPacketIfc: """ This class is like a SystemVerilog interface slave and master attributes are classes which can be used as the magma ports """ def __init__(self, addr_width, data_width): self.addr_width = addr_width self.data_width = data_width self.s...
StanfordAHA/garnet
global_buffer/design/glb_core_load_dma.py
<reponame>StanfordAHA/garnet<gh_stars>10-100 from kratos import Generator, always_ff, always_comb, posedge, resize, clog2, ext from global_buffer.design.glb_loop_iter import GlbLoopIter from global_buffer.design.glb_sched_gen import GlbSchedGen from global_buffer.design.glb_addr_gen import GlbAddrGen from global_buffer...
StanfordAHA/garnet
global_buffer/testvectors/gen_glb_test.py
import random import argparse def gen_reg_pair(f_reglist, f_regpair): with open(f_reglist, 'r') as reglist: num = 0 for line in reglist: if line.startswith("0x"): num += 1 with open(f_reglist, 'r') as reglist, open(f_regpair, 'w') as regpair: regpair.write(f...
StanfordAHA/garnet
global_buffer/gls/gen_sdf_cmd.py
<reponame>StanfordAHA/garnet import argparse def gen_glb_sdf_cmd(filename, num_glb_tiles, mtm, sdf_top, sdf_tile, log): with open(filename, "w") as f: top_cmd = get_sdf_string(sdf_top, 'top.dut', mtm, f"{log}/glb_top.sdf.log") f.write(top_cmd) for i in range(num_glb_tiles): til...
StanfordAHA/garnet
mflowgen/glb_top/construct.py
#! /usr/bin/env python #========================================================================= # construct.py #========================================================================= # Author : # Date : # import os import sys import pathlib from mflowgen.components import Graph, Step from shutil import which ...
StanfordAHA/garnet
cgra/wiring.py
<reponame>StanfordAHA/garnet def glb_glc_wiring(garnet): """ global controller <-> global buffer ports connection """ garnet.wire(garnet.global_controller.ports.reset_out, garnet.global_buffer.ports.reset) garnet.wire(garnet.global_controller.ports.glb_stall, garnet.global_b...