REFBitDoc.tioga
Copyright © 1985 by Xerox Corporation. All rights reserved.
Don Curry September 1, 1985 11:15:39 am PDT
Last Edited by: Don Curry August 8, 1987 10:15:09 am PDT
REFBit
-- Interface and command to access bits in the objects pointed to by REF's
Don Curry
© Copyright 1985 Xerox Corporation. All rights reserved.
Abstract: When designing and simulating hardware, it's sometimes useful to deal with instances of arbitray Cedar TYPEs as if they were arrays of bits.
Created by: Don Curry
Maintained by: Don Curry <Curry.pa>
Keywords: REF BitArray
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

For Internal Xerox Use Only
1. REFBit.mesa
REFBit.mesa is primarily an interface for the procedures:
Size: PROC[ref: REF] RETURNS [size: INT];
Get: PROC[ref: REF, index: INT] RETURNS [val: BOOL];
Set: PROC[ref: REF, index: INT, val: BOOL];
The argument is a REF to a 'direct' Cedar Type such as an enumerated, BOOL, INT, CARDINAL, Subrange or RECORD. 'Direct' means that objects are required not to have REF's or pointers buried in them.
Size returns the number of real bits of data in the object. Get and Put allow each bit to be read and modified. Note that Size[ref] is not necessarily a multiple of 16 since gaps in the packing can (and usually do) occur.
The procedures work by building a description of the format of each REF's object when it is first referenced. These descriptions are cached to speed subsequent references.
2. CommandTool Command: REFBitFormat
REFBitFormat is a command to examine the memory format of a Cedar TYPE. It is most often used to examine the packing of RECORD types. The following is a sample output:
% REFBitFormat IFUPLA.InstrDecodeIn

Bit Format: IFUPLA.InstrDecodeIn
Index First Size Name
0 0 8 state
1 8 1 pipeCycle0

2 15 1 instReady
3 16 8 op
4 24 8 alpha
5 32 8 beta
6 40 1 fpEnabled
7 41 1 iStkEmpty
8 42 1 pushPending
9 43 1 popPending

10 47 1 userMode
---
BitTotal: 39
This shows the location and size of the fields in this record type. Missing rows indicate gaps in the packing. One switch is available:
-b Show single bit format
Bit names used are derived from the field names (if available) in the record.