Skip to content

Instantly share code, notes, and snippets.

View j-marjanovic's full-sized avatar

Jan Marjanovic j-marjanovic

View GitHub Profile
@j-marjanovic
j-marjanovic / conf_FPGA.sh
Last active April 29, 2022 08:43
iCE40 SPI Configuration
#!/bin/bash
# A script to configure Lattice iCE40 FPGA by SPI from Raspberry Pi
#
# Copyright (C) 2015 Jan Marjanovic <[email protected]>
#
# This program 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.
Jan@Jan-PC /tmp
$ nios2-newlib-gen --custom "-O3" --verbose ./build ./lib
Building Newlib may take a few minutes... Please be patient.
Newlib Source Dir: /cygdrive/c/altera/14.1/nios2eds/bin/gnu/src/newlib-1.18
Newlib Build Dir: /tmp/build
Newlib Install Dir: /tmp/lib
Configuring newlib to build a smallc C library in /tmp/build/smallc...
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
BMP Inspector: Prints BPM file information and pixel array statistics
Copyright (C) 2015 Jan Marjanovic <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@j-marjanovic
j-marjanovic / filter.tpl
Created May 19, 2015 21:54
SystemVerilog FIR filter generator
// Copyright (C) 2014 Jan Marjanovic
//`define DEBUG
module filter #(
parameter IO_B = #I0_B#, // input and output data width
parameter INT_B = #INT_B#, // integer part of internal quotient
parameter FRAC_B = #FRAC_B# // integer part of internal quotient
) (
@j-marjanovic
j-marjanovic / README.md
Last active January 3, 2023 00:03
Simple example of MyHDL and Verilog co-simulation

Introduction

This code snippet demonstrates a co-simulation of Verilog code and MyHDL code. The three modules here presents the absolute minimum for a co-simulation.

The counter_top.v is the top level module. It instantiates the counter module (found in file counter.v), which is the module we would like to evaluate. Also instantiated are the signals which are feed from and to MyHDL.

#! /usr/bin/env python3
# -*- coding: utf-8 -*-
'''
The VerilogBits provides Verilog-style representation of the numbers.
Copyright (C) 2015 Jan Marjanovic <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@j-marjanovic
j-marjanovic / DoxverilogLatexIssue
Last active August 10, 2016 20:57
DoxverilogLatexIssue
A small example demonstrating issue when generating LaTeX (HTML is generated
without any problems) with doxverilog.
with line 7 in simple_submodule.v commented out:
------------------------------------------------
➜ latex_bug git:(master) ✗ ls -l latex
#! /usr/bin/env python3
import dataclasses
import enum
import re
from typing import List, Optional
@dataclasses.dataclass
class StratixVPart: