Skip to content

Instantly share code, notes, and snippets.

import os
import subprocess
import sys
env = os.environ.copy()
args = sys.argv[1:]
print(args)
while args:
arg = args.pop(0)
@olofk
olofk / trays.py
Created December 26, 2022 22:38
import sys
from elftools.dwarf.descriptions import describe_form_class
from elftools.elf.elffile import ELFFile
def decode_funcname(dwarfinfo, address):
# Go over all DIEs in the DWARF information, looking for a subprogram
# entry with an address range that includes the given address. Note that
# this simplifies things by disregarding subprograms that may have
# split address ranges.
#define GPIO_ADDR 0x40000000
#define HALT_ADDR 0x90000000
/*
a0 = GPIO address
a1 = String address
t0 = Character to write
*/
.globl _start
@olofk
olofk / Makefile
Last active September 10, 2023 23:09
Bare-metal SERV C example
#
# Makefile: Makefile for building subservient firmware
#
# SPDX-FileCopyrightText: 2021 Olof Kindgren <olof.kindgren@gmail.com>
# SPDX-License-Identifier: Apache-2.0
#
TOOLCHAIN_PREFIX ?= riscv64-unknown-elf-
%.elf: start.S %.c
$(TOOLCHAIN_PREFIX)gcc -Os -march=rv32i -mabi=ilp32 -nostdlib -o $@ \
diff --git a/edalize/icarus.py b/edalize/icarus.py
index 4e62e45..72e6df6 100644
--- a/edalize/icarus.py
+++ b/edalize/icarus.py
@@ -16,7 +16,7 @@ $(TARGET):
iverilog -s$(TOPLEVEL) -c $(TARGET).scr -o $@ $(IVERILOG_OPTIONS)
run: $(VPI_MODULES) $(TARGET)
- vvp -n -M. -l icarus.log $(patsubst %.vpi,-m%,$(VPI_MODULES)) $(TARGET) -fst $(EXTRA_OPTIONS)
+ vvp -n -M. -l icarus.log $(patsubst %.vpi,-m%,$(VPI_MODULES)) $(VVP_OPTIONS) $(TARGET) -fst $(EXTRA_OPTIONS)
CAPI=2:
name : ::timer:0
filesets:
rtl:
files:
- hdl/timer_thing.sv : {file_type : systemVerilogSource}
tb:
`default_nettype none
module servive
(
input wire i_clk,
input wire i_rst_n,
output wire q,
output wire uart_txd);
parameter memfile = "zephyr_hello.hex";
parameter memsize = 8192;
#!/usr/bin/env python3
import io
import os
import shutil
import sys
import tarfile
import urllib.request
class Symbiflow:
def __init__(self, cache_root):
#!/usr/bin/env python3
import argparse
import siliconcompiler as sc
import os
def fusesoc2edam():
from fusesoc.config import Config
from fusesoc.coremanager import CoreManager
121447764 function calls (120912390 primitive calls) in 50.207 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
9 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:103(release)
9 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:143(__init__)
9 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:147(__enter__)
9 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:151(__exit__)
9 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:157(_get_module_lock)