UNISIM and command-line simulation with the Xilinx simulator

I simulate models outside of the Xilinx’ IDE (known as ISE), since the simulation is textual anyhow. Besides, running regression tests without being sure the simulation settings are repeated exactly is a good way to waste time every time the mouse clicks without our full awareness.
Anyhow, my problem was that I instantiated a Xilinx synthesis [...]

Canonizing PCAD netlist files

OK, so the board designer just sent me an updated schematics of the design. Are there any changes? Comparing the schematics itself is hopeless. So I’ll compare the PCAD netfiles (those with a .NET extension). I mean, they are simple text files, after all.
The problem is that Orcad feels free to change the order of [...]

Enumerating FSM states automatically for Verilog with Perl

Having a pretty large state machine, I wanted the states enumerated automatically. Or at least not do the counting by hand. I mean, doing it once is maybe bearable, but what if I’ll want to insert a new state in the future?
So what I was after is something like
module main_state #(parameter
ST_start [...]

A bash wrapper script for setting up environment variables

The problem
Sometimes software packages require setting some environment variables for its proper execution. When these variables clearly have no effect on any other applications in the system, that’s fine. When they want to manipulate some sensitive variables, which other applications may depend on, that’s a whole different story.
When it’s a single executable, the problem is [...]

Xilinx’ MiG memory controller’s init process reverse engineered

Introduction
I’m using Xilinx’ MiG 1.7.3 for running DDR2 memories on a Virtex-4 FPGA. It didn’t take me long to realize that the controller never finishes initialization. The problem is that I had no idea of why, and as far as I know, no documentation to refer to in my attempts to understand where the controller [...]

DCM loses lock on Virtex-4: It’s all about auto calibration

The whole story began when I decided to be kind enough to tell the Xilinx tools (ISE 9.2 in my case) that the Virtex-4 I’m targeting is a grown-up. Stepping 2, to be precise. I added
CONFIG STEPPING = “2″;
to the UCF file. It must have been one of those moments where I believed that the [...]

Verilog: Declaring each port (or argument) once

(…or why the Verilog-emacs AUTOARG is redundant)
In Verilog, I never understood why port declarations appear both in the module declaration, and then immediately afterwards, along with the wires and registers. I mean, if the ports in the module declaration are always deducible from what follows immediately, why is the language forcing me to write it [...]

Porting to Virtex-4: Who ate my IOB registers?

Surprise, surprise!
When porting a design from Spartan-3 to Virtex-4, I discovered that many registers, which were correctly placed in the IOB in the Spartan-3, fell off into fabric-placed flip-flops. Which is very bad news, since keeping the registers in the IOB isn’t just a matter of better timing, but rather repeatable timing, which is much [...]

Getting the right names in the UCF file: Using netgen

The problem: NGDBUILD tells you it can’t find a net or instance given in the UCF file. It’s likely that the synthesizer changed the names, sometimes slightly and sometimes beyond recognition. You need these names to define a timing group, for example, but how do you know them?
Normally, I would get the net and instance [...]

The PCF file: Xilinx timing constraints as the tools understood them

One of the problems with setting up timing constraints in the UCF file, is to be sure that you got the right elements in, and kept the unnecessary ones out.
Suppose I wrote something like
NET “the_clock” TNM_NET = “tnm_ctrl_clk”;
TIMESPEC “TS_ctrl_clk” = PERIOD “tnm_ctrl_clk” 40 ns HIGH 50 %;
What logic element does it apply to? Did it [...]