Close

Strong typing snafu

A project log for Libre Gates

A Libre VHDL framework for the static and dynamic analysis of mapped, gate-level circuits for FPGA and ASIC. Design For Test or nothing !

yann-guidon-ygdesYann Guidon / YGDES 12/01/2020 at 16:290 Comments

VHDL is a strongly typed language : you can define types that, though similar, can't intermix unless you cast them. This is good for code robustness. As long as you get them right. My recent code used strong typing to prevent mixing two similar-looking types, that I finally illustrated on this diagram:

The two types share the "signedness" trick where a number less than 1 indicates a port. The differences are significant though:

At one point I must have been confused and the corresponding diagram made no sense... sink_number_type was used instead of driver_number_type and sinks would point to sinks. That's a virtue of thorough documentation: it helps catch logic errors :-)

The above diagram and the one below are the keys to understand how the netlist is structured. Each sink points to their driver, and each driver points to one sink or a list of sinks. Easy to say, delicate to code :-)

So the confusion is now cleared and I can resume development.

.

.

.

And the result is there : LibreGates_20201202.tbz

Discussions