Skip to content

Instantly share code, notes, and snippets.

View sbourdeauducq's full-sized avatar

Sébastien Bourdeauducq sbourdeauducq

View GitHub Profile
@sbourdeauducq
sbourdeauducq / minimal_cairo_xcb.rs
Last active April 19, 2020 13:32
Computer graphics like it's MS-DOS
// Small example of drawing on a Linux graphics screen, with relatively sane graphics
// primitives and a minimal amount of wacko libraries.
// See: The Unix-Haters Handbook, chapter 7 "The X-Windows Disaster"
extern crate xcb;
extern crate cairo;
extern crate cairo_sys;
use std::mem::transmute;
@sbourdeauducq
sbourdeauducq / install-artiq.sh
Last active February 9, 2019 15:04
Install ARTIQ from hydra conda packages
#!/bin/sh
set -e
# This script needs to be run in the root conda environment.
# The name of the conda environment to create
CONDA_ENV_NAME=artiq
# The conda packages to download from hydra and install
CONDA_PACKAGES="artiq artiq-board-kasli-tester"
[ 18.219447s] INFO(board_artiq::jesd204sync): dt=22
[ 18.224307s] INFO(board_artiq::jesd204sync): dt=18
[ 18.229169s] INFO(board_artiq::jesd204sync): dt=15
[ 18.234032s] INFO(board_artiq::jesd204sync): dt=10
[ 18.238894s] INFO(board_artiq::jesd204sync): dt=6
[ 18.243670s] INFO(board_artiq::jesd204sync): dt=2
[ 18.248446s] INFO(board_artiq::jesd204sync): dt=62
[ 18.253309s] INFO(board_artiq::jesd204sync): dt=58
[ 18.258171s] INFO(board_artiq::jesd204sync): dt=54
[ 18.263034s] INFO(board_artiq::jesd204sync): dt=50
@sbourdeauducq
sbourdeauducq / artiq-board.nix
Created January 23, 2019 14:01
hack to build artiq firmware on nix
# run with:
# nix-build --option sandbox false artiq-board.nix
#
# sandbox disabling is needed by:
# 1) Vivado (installed in /opt, bypassing nix) - will likely keep needing it
# 2) cargo - can be improved after carnix becomes less buggy, or by looking into buildRustPackage
let
pkgs = import <nixpkgs> {};
buildenv = import ./artiq-dev.nix {
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
from migen.genlib.cdc import PulseSynchronizer
from microscope import *
from misoc.cores.liteeth_mini.phy.pcs_1000basex import *
class Gearbox(Module):
def __init__(self):
@sbourdeauducq
sbourdeauducq / gtwizard.py
Last active January 14, 2019 02:55
quick and dirty hack to extract GTH transceiver parameters
from collections import OrderedDict
from pyverilog.vparser.parser import parse
from pyverilog.vparser import ast
topnode, directives = parse(["/home/sb/ultrascaletest/ultrascaletest.srcs/sources_1/ip/gtwizard_ultrascale_0/synth/gtwizard_ultrascale_0_gthe3_channel_wrapper.v"])
gth_inst = None
def ast_walk(nodes):
# FIXME: Should be rewritten to use the same structure as nixpkgs rustc.
{ stdenv, targetPackages
, fetchFromGitHub, configureFlags ? []
, llvm-or1k, cmake, curl, cacert, git, which, libffi
, ncurses, file, python2, pkgconfig, openssl
}:
stdenv.mkDerivation {
name = "rustc_or1k-1.28.0";
@sbourdeauducq
sbourdeauducq / sawg_rst.diff
Created June 24, 2018 14:04
SAWG reset control
diff --git a/artiq/firmware/ksupport/api.rs b/artiq/firmware/ksupport/api.rs
index 20efa141..86b5e952 100644
--- a/artiq/firmware/ksupport/api.rs
+++ b/artiq/firmware/ksupport/api.rs
@@ -121,4 +121,6 @@ static mut API: &'static [(&'static str, *const ())] = &[
api!(spi_set_config = ::nrt_bus::spi::set_config),
api!(spi_write = ::nrt_bus::spi::write),
api!(spi_read = ::nrt_bus::spi::read),
+
+ api!(sawg_rst = ::board_misoc::csr::sawg_rst::reset_write)
diff --git a/artiq/gateware/targets/sayma_amc.py b/artiq/gateware/targets/sayma_amc.py
index abb614977..4fc80c5b3 100755
--- a/artiq/gateware/targets/sayma_amc.py
+++ b/artiq/gateware/targets/sayma_amc.py
@@ -251,14 +251,14 @@ class Master(MiniSoC, AMPSoC, RTMCommon):
self.config["I2C_BUS_COUNT"] = 1
self.config["HAS_SI5324"] = None
self.config["SI5324_AS_SYNTHESIZER"] = None
- self.config["SI5324_SAYMA_REF"] = None
+ self.config["RTIO_FREQUENCY"] = str(rtio_clk_freq/1e6)
@sbourdeauducq
sbourdeauducq / runtime_crc.diff
Created June 23, 2018 04:13
track runtime corruption
diff --git a/artiq/firmware/runtime/Cargo.toml b/artiq/firmware/runtime/Cargo.toml
index f7eb87ac..6c36c0fa 100644
--- a/artiq/firmware/runtime/Cargo.toml
+++ b/artiq/firmware/runtime/Cargo.toml
@@ -19,6 +19,7 @@ failure_derive = { version = "0.1", default-features = false }
byteorder = { version = "1.0", default-features = false }
cslice = { version = "0.3" }
log = { version = "0.4", default-features = false }
+crc = { version = "1.7", default-features = false }
managed = { version = "0.6", default-features = false, features = ["alloc", "map"] }