[ Content | Sidebar ]

Archives for programming

Writes Your Makefiles For You

I’ve been dogfooding my VHDL compiler for a project at work and now that it’s gotten to the point where it can simulate non-trivial designs, compile times are becoming significant. Especially when files use Xilinx primitives as the vcomponents library takes a while to load. At the moment I’m re-analysing every source file for each […]

Improved Waveform Output

I’ve spent a lot of time recently improving the waveform output of my VHDL compiler / simulator. Previously only the simple VCD format was supported: this only allows Verilog-style 4-value logic types to be dumped so doesn’t map very well onto VHDL types. The implementation was also very inefficient resulting in a 3-4x slowdown in […]

Automagic Debugging

It’s kind of annoying to have to go back and run GDB after your program crashes. Here’s a signal handler I’ve been using which drops you into GDB straight away: static void gdb_sighandler(int sig, siginfo_t *info) { char exe[256]; if (readlink("/proc/self/exe", exe, sizeof(exe)) < 0) { perror("readlink"); exit(EXIT_FAILURE); }   char pid[16]; snprintf(pid, sizeof(pid), "%d", […]

Portable high resolution timestamps from stat

A small nugget of information that might be useful to someone: The standard timestamps in struct stat have type time_t which only gives a resolution of seconds which is less than required in many situations. Luckily most operating systems provide a higher resolution timestamp within struct stat but the field name differs among Linux, BSD, […]

VHDL compiler improvements

A while ago I posted about a VHDL compiler I’d started writing. Well I’ve been working on it a bit during the evenings and weekends and it’s acquired several new features. Probably the most significant is that it can now compile the standard IEEE std_logic_1164 and numeric_std packages as well the Synopsys std_logic_arith and std_logic_unsigned […]

Writing a VHDL compiler

I haven’t posted much about any of my projects for a some time. This is because I’ve spent the past few months squirrelling away on something new: a while ago I decided a good way to learn more about VHDL would be to write a parser/checker for it. I had a vague plan of using […]

Conky BBC weather

I’ve written a Ruby script called bbc-weather.rb that parses the BBC weather RSS for a particular location and formats the data for conky. Here’s an example: To use it insert the following in your .conkyrc: ${execpi 600 ruby /path/to/bbc-weather.rb 4197} This will refresh every hour. Replace 4197 with the number of your local weather station. […]

Emacs commit message mode

Here’s a really trivial Emacs major mode for editing Git and Mercurial commit messages: commit-msg-mode.el. It works in basically the same way as the Vim mode, highlighting the summary line, help text, etc. To use it, put it on your load-path and add the following to your .emacs: (autoload ‘commit-msg-mode “commit-msg-mode” “Major mode for editing […]

Cuckoo Hashes in Lisp

I’ve been learning about cuckoo hashing this evening and to help with that I’ve written an implementation in Common Lisp that others might find useful: cuckoo.lisp. It provides a package cuckoo which exports make-cuckoo-hash, cuckoo-insert, cuckoo-lookup, and cuckoo-delete which perform the obvious hash-table operations. The key feature of cuckoo hashes, if you haven’t come across […]

Chicken SLIME now an Egg

The Chicken Scheme SWANK implementation I’ve been working on is now available from the main Egg repository. So now you don’t need to faff about with Git and can install it like any other extension using: chicken-install slime Follow the instructions on the Chicken Wiki to get it set up. I’ll be mirroring changes in […]