Skip to content

Instantly share code, notes, and snippets.

View scollinson's full-sized avatar

Sam Collinson scollinson

View GitHub Profile
#!/bin/bash
sed /mnt/scratch/xilinx/14.5/ISE_DS/common/bin/lin64/xusbdfwu.rules -e 's:BUS=="usb", ::g' -e 's:SYSFS:ATTRS:g' -e 's:TEMPNODE:tempnode:g' > /etc/udev/rules.d/xusbdfwu.rules
cp /mnt/scratch/xilinx/14.5/ISE_DS/common/bin/lin64/xusb*.hex /usr/share/
service udev restart
@scollinson
scollinson / gist:10705300
Last active August 29, 2015 13:59
dual data rate register
if rising_edge(clk) then
q <= d1;
elsif falling_edge(clk) then
q <= d2;
end if;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_unsigned.all;
library unisim;
use unisim.vcomponents.all;
entity valid_store is
port (

Keybase proof

I hereby claim:

  • I am scollinson on github.
  • I am scollinson (https://keybase.io/scollinson) on keybase.
  • I have a public key whose fingerprint is 8949 587C 2DD3 896D 2B81 1652 C533 09CD FDA9 9E56

To claim this, I am signing this object:

@scollinson
scollinson / gist:8553582
Last active January 4, 2016 02:09
for a given maximum comparator width, determine a list of comparator stages
MAX_COMPARATOR_WIDTH = 24
def stages(n, max_width=MAX_COMPARATOR_WIDTH):
s = []
while n > 1:
q = n // max_width
r = n % max_width
s.append([max_width]*q + [r])
end if;
end if;
end case;
end case;
end if;
end if;
end process;
dq, tap_cnt
0 13
1 13
2 13
3 13
4 13
5 24
6 13
7 13
8 13
dq, tap_cnt
0 0
1 10
2 0
3 0
4 0
5 11
6 0
7 0
8 0
@scollinson
scollinson / gist:5701772
Created June 3, 2013 21:52
PCIe Read Requests and Completions
# Read requests
# id, length, dw1, dw2
0 128 00000080010000FF 0022A000D0DAD0DA
1 128 00000080010001FF 0022A080D0DAD0DA
2 128 00000080010002FF 0022A100D0DAD0DA
3 128 00000080010003FF 0022A180D0DAD0DA
4 128 00000080010004FF 0022A200D0DAD0DA
5 128 00000080010005FF 0022A280D0DAD0DA
6 128 00000080010006FF 0022A300D0DAD0DA
7 128 00000080010007FF 0022A380D0DAD0DA
@scollinson
scollinson / grabaseat.py
Created July 17, 2012 03:21
kiwicon grabaseat script
#!/usr/bin/env python
"""
Script to poll grabaseat.co.nz for cheap flights to and from conferences
Written by Sam Collinson ([email protected]) on 19/08/10
** Updated 17/07/12 with new URL
"""
import urllib, urllib2
from datetime import datetime, date
from sys import version_info