So, as part of the work on getting our QSIC card to support SD cards for
storage, Dave and I have produced some tools that people might find useful.

Dave's original concept was to do SD support with a state machine. However,
the SD protocol turned out to be a little too complex for that, so we decided
to create a bespoke micro-engine (hereinafter 'uengine' - I use 'u' in place
of the lower-case 'mu' all the time) to handle it.

This turned out to be a good call; Dave cranked out a uengine in Verilog
(which was incredibly quick to produce), and I whipped up (literally - the
first version was done overnight) a uassembler. The latter has since been
much improved; the current version reads the entire definition of the uengine
from a configuration file, and thus should be usable on any umachine.

So, if you need a uassembler for some project, here's one. (And if you need
something it can't do, let me know, and I can add stuff; e.g. it doesn't
currently support the '+' operator in literals, only '|', but it would be
fairly simple to add '+' if anyone had a use for it.)


The source is here:

  http://ana-3.lcs.mit.edu/~jnc/tech/QSIC/tools/uas.c

(and no, I don't have the energy to learn how to use sourceforge or github to
distribute it, so don't bug me about it). I wrote it under Cygwin on Windows,
but Dave compiled and runs it on Linux as-is, so it's pretty portable. 

The current output format is hex that Dave massages into 'ROM' contents on
the FPGA in some fashion I don't know the details of, but if anyone needs
something different, again, I'd be happy to add whatever's needed.

The source syntax supported is documented in comments at the start of the
uassembler source; it's pretty simple, here's a brief synopsis (see the file
for more detail). ucode is a collection of lines, one per micro-instruction.
The syntax for individual lines is:

  {<label>:} <operator>{, <operator>}... {<literal>}

<operator> can be either: <value> (symbolic) or <field>=<fvalue> (where
fvalue can be symbolic or numeric); specific symbolic values are assigned by
the configuration file (where they are defined) to specific fields.
<literal> is <data>{|<data>}... where <data> is symbolic (a label, or a
value) or numeric. Forward references to labels are supported. Numeric items
(everywhere) are either octal, decimal or hex. Whitespace (either space(s) or
tab(s)) can be used in most places. Comments start with a ';' or '/', and the
rest of the line is ignored.

A sample umachine configuration file (for the QSIC uengine) is here:

  http://ana-3.lcs.mit.edu/~jnc/tech/QSIC/tools/ueng

and the (simple) format of the config file is documented in the comments at
the start.

A sample source file for uas for that uengine is here:

  http://ana-3.lcs.mit.edu/~jnc/tech/QSIC/sd.asm

if you want to see what source looks like.


Dave has a github site where all his stuff is available; the latest version
of the ucode is here:

  https://github.com/dabridgham/QSIC/blob/master/verilog/sd.asm

and the whole thing is here:

  https://github.com/dabridgham/QSIC

including the Verilog for the uengine. Dave reports that it should be easy to
adapt his uengine design to other uses, it should run in pretty much any
FPGA. So if you want to build a PDP-15 (or a Multics! :-) in an FPGA, there
you go. Dave indicates he'd be happy to help anyone who needs to tweak the
uengine design for their particular application.


Hopefully someone will find this useful!

        Noel

Reply via email to