Adding a work library

The upcoming new release has another major change in it – I’ve started using a work library.

In VHDL, a work library saves you from having to declare components in each source that uses those components. Sort-of like an #include file in C. I hadn’t really looked into using a work library before – because updates to the components were mostly simple enough, and didn’t happen too often. But with the addition more supported boards, and with the addition of MINC both with a lot of new signals on the unibus component and a lot of new sensor drivers, that became different, and a work library suddenly began to make a lot of sense.

For now, it is in the simplest form – a file named pdp2011.vhd that contains all component declarations that are likely to be used in more than one source file. Each source file that uses those components now only needs to have a line in it as follows:

use work.pdp2011.all;

That’s all – I’ve updated all the current top.vhd files to use the library, and also to use a standard shared sdram driver instead of the tedious cut-and-past of almost the same core in each top that uses sdram.

If you’re going to make any changes to the configuration, you’ll find that it’s a lot easier to find the things you want; the top.vhd are a lot less cluttered with boilerplate. There’s one thing though – because the pdp2011 components are now declared at the same hierarchical level as the logic libraries, two components cause a clash in the name space: the cr (which you would not likely need to know about – it deals with the set of control registers for that particular cpu model); and the vt (which you might be aware of – it’s the embedded terminal).

I’m still pondering suitable alternate names for cr and vt that don’t clash with the ascii character set – but pending that, there’s a simple solution: prefix the instantiation with the work library qualifier. As so:

   vt0: work.vt port map(
      ...
   );

Leave a Reply