This file contains 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
/// Extract the specified fields from the `Peripherals` struct into several named | |
/// structs which can be passed to other tasks to provide them with all their | |
/// resources, including pins, peripherals, DMA channels, etc. | |
/// | |
/// The `peripherals` module must be in scope when `resource_assigs!{}` is called, | |
/// and it defines a new macro `split_resources!()` which uses the `Peripherals` struct | |
/// and returns a new struct with a field for each of the structs named in `resource_assigs!{}`. | |
/// | |
/// Defines new structs containing the specified structs from the `peripherals` module, | |
/// a top-level struct that contains an instance of each of these new structs, and a macro |
This file contains 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
#!/usr/bin/env python3 | |
import re | |
import sys | |
import time | |
import subprocess | |
import multiprocessing | |
import termplotlib as tpl | |
import numpy as np |
This file contains 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
import subprocess | |
import nmigen as nm | |
from nmigen.build import Resource, Pins, PinsN, Attrs, Clock, Subsignal | |
from nmigen.vendor.lattice_ecp5 import LatticeECP5Platform | |
class UART(nm.Elaboratable): | |
def __init__(self, data, divider=217, n=8): | |
assert divider >= 1 | |
self.valid = nm.Signal() |
This file contains 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
""" | |
Takes an ecpunpack output .config file and a iodb.json and works out attributes | |
set for each package pin as best it can. | |
LFE5U-25F-xBG256 only. | |
""" | |
import re | |
import sys | |
import json |
This file contains 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
import io | |
import sys | |
import time | |
import socket | |
import struct | |
from PIL import Image | |
if len(sys.argv) != 3: | |
print("Usage: screenshot.py <IP address> <filename>") |
This file contains 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
import sys | |
import os.path | |
import yaml | |
MAP = yaml.safe_load(""" | |
f301: | |
3: a b c | |
2: a b c d | |
1: a b c f |
This file contains 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
#lang rosette/safe | |
(require rosette/lib/angelic rosette/lib/match) | |
; Circuit building block: NAND gates only | |
(struct nand (x y) #:transparent) | |
(define (interpret p) | |
(match p | |
[(nand x y) (not (and (interpret x) (interpret y)))] | |
[_ p])) |
This file contains 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
#!/bin/sh | |
# Convert a raw binary image into an ELF file suitable for loading into a disassembler | |
cat > raw$$.ld <<EOF | |
SECTIONS | |
{ | |
EOF | |
echo " . = $3;" >> raw$$.ld |
This file contains 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
import traceback | |
from binaryninja import (BinaryView, Architecture, SegmentFlag, log_error, | |
get_address_input, log_info, SectionSemantics) | |
offset = 0x08000000 | |
entry_addr = 0x080001c0 | |
class FwImgView(BinaryView): |
This file contains 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 migen import Module, Signal, FSM, If, NextState, NextValue | |
class AXI3SlaveReader(Module): | |
""" | |
AXI3 read-only slave. | |
Input signals are from the AXI3 master AR and R ports. | |
`regfile` is an Array which is indexed to respond to reads. |
NewerOlder