Looks like what he really wants is to use Ada which has had much better support for low-level programming than C.<p>Example:<p>Word : constant := 4; -- storage element is byte, 4 bytes per word<p>type State is (A,M,W,P);
type Mode is (Fix, Dec, Exp, Signif);<p>type Byte_Mask is array (0..7) of Boolean;
type State_Mask is array (State) of Boolean;
type Mode_Mask is array (Mode) of Boolean;<p>type Program_Status_Word is
record
System_Mask : Byte_Mask;<p><pre><code> Protection_Key : Integer range 0 .. 3;
Machine_State : State_Mask;
Interrupt_Cause : Interruption_Code;
Ilc : Integer range 0 .. 3;
Cc : Integer range 0 .. 3;
Program_Mask : Mode_Mask;
Inst_Address : Address;
end record;
for Program_Status_Word use
record
System_Mask at 0*Word range 0 .. 7;
Protection_Key at 0*Word range 10 .. 11; -- bits 8,9 unused
Machine_State at 0*Word range 12 .. 15;
Interrupt_Cause at 0*Word range 16 .. 31;
Ilc at 1*Word range 0 .. 1; -- second word
Cc at 1*Word range 2 .. 3;
Program_Mask at 1*Word range 4 .. 7;
Inst_Address at 1*Word range 8 .. 31;
end record;
for Program_Status_Word'Size use 8*System.Storage_Unit;
for Program_Status_Word'Alignment use 8;
</code></pre>
More info:
<a href="https://www.adaic.org/resources/add_content/standards/05aarm/html/AA-13-5-1.html" rel="nofollow">https://www.adaic.org/resources/add_content/standards/05aarm...</a>