Re: Unions - overlaying bits & logic


Subject: Re: Unions - overlaying bits & logic
From: Kevin Cameron x3251 (dkc@galaxy.nsc.com)
Date: Tue Apr 09 2002 - 11:21:12 PDT


Wouldn't mind a response from Co-Design on this before the next meeting.

Ta,
Kev.

> Apart from endianess, there is an issue with size of data in unions. The types bit,char,integer etc. are
> as in C, but types like "logic" do not have a defined bit representation - it could be:
>
> A: an enum (e.g. L0=0,L1=1,LX=2,LZ=3) - requires 2 bits (per node)
> B: value & strength (0,1,X) * (1,Z) - requires 3 bits
> C: value, strength and certainty (0,1) * (1,Z) * (1,X) - also 3 bits, but different coding
>
> I think it is therfore impossible to sensibly overlay logic and bit types, unions should have
> either all logic or all bit as the base type of all elements. The alternative is to store the
> X & Z orthogonally so that only the bit value is overlayed (using representation C),
> which has performance issues.
>
> If a union of "structs" is declared, the the fields being overlayed should match in their
> base type (rather than the whole struct).
>
> [Note: 'logic' and 'reg' should probably be something other than 'integer_type' in the BNF]
>
> Kev.



This archive was generated by hypermail 2b28 : Tue Apr 09 2002 - 11:23:12 PDT