• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Quick C struct question

dishawbr

Member
typedef struct RRR

{

signal3 opcode:3;

signal3 rega:3;

signal3 regb:3;

signal2 zeros:2;

signal2 mores:2;

signal3 regc:3;

}RRR;



typedef struct RRI

{

signal3 opcode:3;

signal3 rega:3;

signal3 regb:3;

signal7 immediate:7;

}RRI;



typedef struct RI

{

signal3 opcode:3;

signal3 rega:3;

signal3 immediate:3;

signal7 immediate2:7;

}RI;



union all

{

struct RRR;

struct RRI;

struct RI;

signal16 IR;

};





union all var_name;

var_name.IR = IR;



then later

control(var_name.RRR.opcode);



it tells me that there is no member RRR in the union.. what am I doing wrong?
 
Shouldn't it be:

union all

{

struct RRR foo;

struct RRI bar;

struct RI foobar;

signal16 IR;

};


then:

union all var_name;
function_call(var_name.foo.opcode );
 
Back
Top