€DF/DRAFT/Graphics system structure/Page |P/ €DH/VLSI Design Aids Group//Graphics/ Levels_ of_ hierarchy (or where to draw the line...) At the top end of the scale is the CAD database, which stores the geometry of leaf-cells and the topology between them. The shapes which this system understands are polygons: collections of sheets with positive or negative sense, which may recursively contain sheets of the opposite sense within their boundaries. These polygons are manipulated with the polygon package described elsewhere. The data structures of the polygon package are exported opaquely to the CAD database (the BLOB). Below this is the high-level graphics system. It understands only sheets of positive sense (stuff, as opposed to hole). If a cell contains geometry which has a hole in it, two things can happen. Either it is a feature like a contact cut going through diffusion and metal in which case the diffusion is considered to be a solid area, and the cut is treated as a positive area on the 'cut' layer, or the hole was generated by encircling an area completely, as in the diffusion path around an IO pad. In this case the diffusion area must be passed to the high-level graphics package as more than one sheet. (Terminology: Stick a pair of scissors in an infinite lump of cardboard, and snip away anti-clockwise round some path until you get back to the starting point. The piece of cardboard which falls out of the middle is a sheet of positive sense (or a 'positive sheet') and the infinite lump of cardboard which is left over (or the hole in space depending on how you look at it) is a sheet of negative sense (or a 'negative sheet'). For simplicity, we call these two types of sheet either 'hole' or 'stuff' as appropriate.) Below this is the machine independant graphics package; it understands sheets of up to 4 vertices - Boxes and Triangles to you! This level deals in Lambda-based co-ordinates and knows nothing about screen size or aspect ratios etc. The high-level package above dissects its sheets into triangles before passing them to this software. The primitive 'box' is implemented by this layer for two reasons. The first is that wires are not stored in the BLOB as polygonal features: they are in fact generated by the THING on request, and will always be rectangular. Secondly, much of the data in the BLOB will have been generated from calls to 'box' procedures in various layout languages. It should be worthwhile to take advantage of the frequency of this and avoid the intermediate stages of bundling up into sheets and dissecting back into triangles. At the very bottom are the BBC specific IO routines - these talk in terms of BBC virtual co-ordinates (which we might as well think of as device co-ordinates) and BBC physical colours. They are, however, 'cleaned up' before presentation to the caller. Some of the work which could be done by the IO processor is done by these procedures: for instance they hold the logical to physical colour relationships, because the physical colours in our scheme are actually a mixture of stippled colours and are not directly catered for by the BBC micro software. Some of the packages on the way down serve a dual role: The machine independant package offers the user completely hardware-independant calls, but it itself makes very hardware dependant calls to the lower levels in order to save the user doing so. For instance, the various surface layers in the VLSI system are passed down as follows: 1) The top-level CAD packages invents the types 'LAYER' and 'LAYERS' where LAYER is something like (POLY,DIFF,NWELL,PWELL,...) and LAYERS is a SET OF LAYER, and uses these layer denotations as virtual colours. 2) The machine independant package assigns BBC colours to the layers, (knowing the colour conventions of the level above) and makes the calls to the BBC IO package to define the stipple patterns. (There are not enough pure colours to assign one per layer). 3) The BBC IO package sends the colour mixing bytes to the stipple- package resident in the BBC, and issues the drawing commands to the BBC operating system. The interfaces between all these layers are procedural, but the procedures actually called are allowed to bundle up their parameters into text and send it down a serial line. At the other end, a program will be running which gathers up this text until it has enough for a full command, at which point it will call the appropriate procedure. This is effectively a remote procedure call, and will be implemented as such rather than as a graphics protocol. This is more general and it allows us to easily change to real remote procedure calling should a more powerful networking system become available. It is not clear that any level of the hierarchy can call other levels except the one immediately below itself. This is because the interfaces may be implemented by hardware, and there will be no direct route from any level to any other except through the interfaces provided. If it is felt necessary, low-level calls could perhaps be implemented by dummy procedures passing their arguments down to the level below. The utility of this is open to debate. The reason that the system is layered in this way is to make it easier to split the activities between processors in a multi-processor implementation. €DH/DRAFT/High level interface/Page |P/ €PE DEFINITION MODULE HighLevelGraphics; PROCEDURE DrawBox (XL, YB, XR, YT :LAMBDA; Annotation :ARRAY OF CHAR); PROCEDURE DrawSheet (Sheet :OUTLINE); PROCEDURE WhatNext (VAR Layers :LAYERS); PROCEDURE NextIs (Layers :LAYERS); END HighLevelGraphics. €DH/DRAFT/Low level interface/Page |P/ €PE DEFINITION MODULE LowLevelGraphics; PROCEDURE Surface (XL, YB, XR, YT :LAMBDA; OnLayers :LAYERS); PROCEDURE Box (XL, YB, XR, YT :LAMBDA; OnLayers :LAYERS; Annotation :ARRAY OF CHAR); PROCEDURE Triangle (X1,Y1, X2,Y2, X3,Y3 :LAMBDA; OnLayers :LAYERS) PROCEDURE GetXY (VAR LambdaX, LambdaY :LAMBDA); END LowLevelGraphics. €DH/DRAFT/Device driver/Page |P/ €PE DEFINITION MODULE BBCspecific; PROCEDURE Move (X, Y :BBCxy); PROCEDURE Line (X, Y :BBCxy); PROCEDURE MoveRel (X, Y :BBCxy); PROCEDURE LineRel (X, Y :BBCxy); PROCEDURE DefineColour (Colour :ECFGcolour; TL, TR, BL, BR :BBCcolour); PROCEDURE SelectColour (Colour :ECFGcolour); PROCEDURE DrawingMode; PROCEDURE CursorMode; PROCEDURE GetPoint (VAR X, Y :BBCxy); PROCEDURE GraphWindow (XL, YB, XR, YT :BBCxy); PROCEDURE TextWindow (XL, YB, XR, YT :BBCxy); END BBCspecific.