SCP: Add generic REGDATA register populating macro.
This allows simulator code to be insulated from any changes which may be made to the REG structure in the future. The REGDATA macro will be update as needed to avoid any changes in simulator specific code.
This commit is contained in:
parent
a7938b455c
commit
3ff89074f5
2 changed files with 33 additions and 29 deletions
BIN
doc/simh.doc
BIN
doc/simh.doc
Binary file not shown.
62
sim_defs.h
62
sim_defs.h
|
@ -764,11 +764,22 @@ struct FILEREF {
|
|||
int32 refcount; /* reference count */
|
||||
};
|
||||
|
||||
/* The following macros define structure contents */
|
||||
/*
|
||||
The following macros exist to help populate structure contents
|
||||
|
||||
They are dependent on the declaration order of the fields
|
||||
of the structures they exist to populate.
|
||||
|
||||
*/
|
||||
|
||||
#define UDATA(act,fl,cap) NULL,act,NULL,NULL,NULL,0,0,(fl),0,(cap),0,NULL,0,0
|
||||
|
||||
#if defined (__STDC__) || defined (_WIN32)
|
||||
#if defined (__STDC__) || defined (_WIN32) /* Variants which depend on how macro arguments are convered to strings */
|
||||
/* Generic Register declaration for all fields.
|
||||
If the register structure is extended, this macro will be retained and a
|
||||
new macro will be provided that populates the new register structure */
|
||||
#define REGDATA(nm,loc,rdx,wd,off,dep,desc,flds,fl,qptr,siz) \
|
||||
#nm, &(loc), (rdx), (wd), (off), (dep), (desc), (flds), (fl), (qptr), (siz)
|
||||
/* Right Justified Octal Register Data */
|
||||
#define ORDATA(nm,loc,wd) #nm, &(loc), 8, (wd), 0, 1, NULL, NULL
|
||||
/* Right Justified Decimal Register Data */
|
||||
|
@ -781,12 +792,6 @@ struct FILEREF {
|
|||
#define GRDATA(nm,loc,rdx,wd,pos) #nm, &(loc), (rdx), (wd), (pos), 1, NULL, NULL
|
||||
/* Arrayed register whose data is kept in a standard C array Register */
|
||||
#define BRDATA(nm,loc,rdx,wd,dep) #nm, (loc), (rdx), (wd), 0, (dep), NULL, NULL
|
||||
/* Arrayed register whose data is part of the UNIT structure */
|
||||
#define URDATA(nm,loc,rdx,wd,off,dep,fl) \
|
||||
#nm, &(loc), (rdx), (wd), (off), (dep), NULL, NULL, ((fl) | REG_UNIT)
|
||||
/* Arrayed register whose data is part of an arbitrary structure */
|
||||
#define STRDATA(nm,loc,rdx,wd,off,dep,siz,fl) \
|
||||
#nm, &(loc), (rdx), (wd), (off), (dep), NULL, NULL, ((fl) | REG_STRUCT), (siz)
|
||||
/* Same as above, but with additional description initializer */
|
||||
#define ORDATAD(nm,loc,wd,desc) #nm, &(loc), 8, (wd), 0, 1, (desc), NULL
|
||||
#define DRDATAD(nm,loc,wd,desc) #nm, &(loc), 10, (wd), 0, 1, (desc), NULL
|
||||
|
@ -794,10 +799,6 @@ struct FILEREF {
|
|||
#define FLDATAD(nm,loc,pos,desc) #nm, &(loc), 2, 1, (pos), 1, (desc), NULL
|
||||
#define GRDATAD(nm,loc,rdx,wd,pos,desc) #nm, &(loc), (rdx), (wd), (pos), 1, (desc), NULL
|
||||
#define BRDATAD(nm,loc,rdx,wd,dep,desc) #nm, (loc), (rdx), (wd), 0, (dep), (desc), NULL
|
||||
#define URDATAD(nm,loc,rdx,wd,off,dep,fl,desc) \
|
||||
#nm, &(loc), (rdx), (wd), (off), (dep), (desc), NULL, ((fl) | REG_UNIT)
|
||||
#define STRDATAD(nm,loc,rdx,wd,off,dep,siz,fl,desc) \
|
||||
#nm, &(loc), (rdx), (wd), (off), (dep), (desc), NULL, ((fl) | REG_STRUCT), (siz)
|
||||
/* Same as above, but with additional description initializer, and bitfields */
|
||||
#define ORDATADF(nm,loc,wd,desc,flds) #nm, &(loc), 8, (wd), 0, 1, (desc), (flds)
|
||||
#define DRDATADF(nm,loc,wd,desc,flds) #nm, &(loc), 10, (wd), 0, 1, (desc), (flds)
|
||||
|
@ -805,47 +806,33 @@ struct FILEREF {
|
|||
#define FLDATADF(nm,loc,pos,desc,flds) #nm, &(loc), 2, 1, (pos), 1, (desc), (flds)
|
||||
#define GRDATADF(nm,loc,rdx,wd,pos,desc,flds) #nm, &(loc), (rdx), (wd), (pos), 1, (desc), (flds)
|
||||
#define BRDATADF(nm,loc,rdx,wd,dep,desc,flds) #nm, (loc), (rdx), (wd), 0, (dep), (desc), (flds)
|
||||
#define URDATADF(nm,loc,rdx,wd,off,dep,fl,desc,flds) \
|
||||
#nm, &(loc), (rdx), (wd), (off), (dep), (desc), (flds), ((fl) | REG_UNIT)
|
||||
#define STRDATADF(nm,loc,rdx,wd,off,dep,siz,fl,desc,flds) \
|
||||
#nm, &(loc), (rdx), (wd), (off), (dep), (desc), (flds), ((fl) | REG_STRUCT), (siz)
|
||||
#define BIT(nm) {#nm, 0xffffffff, 1} /* Single Bit definition */
|
||||
#define BITNC {"", 0xffffffff, 1} /* Don't care Bit definition */
|
||||
#define BITF(nm,sz) {#nm, 0xffffffff, sz} /* Bit Field definition */
|
||||
#define BITNCF(sz) {"", 0xffffffff, sz} /* Don't care Bit Field definition */
|
||||
#define BITFFMT(nm,sz,fmt) {#nm, 0xffffffff, sz, NULL, #fmt}/* Bit Field definition with Output format */
|
||||
#define BITFNAM(nm,sz,names) {#nm, 0xffffffff, sz, names} /* Bit Field definition with value->name map */
|
||||
#else
|
||||
#else /* For non-STD-C compiler which can't stringify macro arguments with # */
|
||||
#define REGDATA(nm,loc,rdx,wd,off,dep,desc,flds,fl,qptr,siz) \
|
||||
"nm", &(loc), (rdx), (wd), (off), (dep), (desc), (flds), (fl), (qptr), (siz)
|
||||
#define ORDATA(nm,loc,wd) "nm", &(loc), 8, (wd), 0, 1, NULL, NULL
|
||||
#define DRDATA(nm,loc,wd) "nm", &(loc), 10, (wd), 0, 1, NULL, NULL
|
||||
#define HRDATA(nm,loc,wd) "nm", &(loc), 16, (wd), 0, 1, NULL, NULL
|
||||
#define FLDATA(nm,loc,pos) "nm", &(loc), 2, 1, (pos), 1, NULL, NULL
|
||||
#define GRDATA(nm,loc,rdx,wd,pos) "nm", &(loc), (rdx), (wd), (pos), 1, NULL, NULL
|
||||
#define BRDATA(nm,loc,rdx,wd,dep) "nm", (loc), (rdx), (wd), 0, (dep), NULL, NULL
|
||||
#define URDATA(nm,loc,rdx,wd,off,dep,fl) \
|
||||
"nm", &(loc), (rdx), (wd), (off), (dep), NULL, NULL, ((fl) | REG_UNIT)
|
||||
#define STRDATA(nm,loc,rdx,wd,off,dep,siz,fl) \
|
||||
"nm", &(loc), (rdx), (wd), (off), (dep), NULL, NULL, ((fl) | REG_STRUCT), (siz)
|
||||
#define ORDATAD(nm,loc,wd,desc) "nm", &(loc), 8, (wd), 0, 1, (desc), NULL
|
||||
#define DRDATAD(nm,loc,wd,desc) "nm", &(loc), 10, (wd), 0, 1, (desc), NULL
|
||||
#define HRDATAD(nm,loc,wd,desc) "nm", &(loc), 16, (wd), 0, 1, (desc), NULL
|
||||
#define FLDATAD(nm,loc,pos,desc) "nm", &(loc), 2, 1, (pos), 1, (desc), NULL
|
||||
#define GRDATAD(nm,loc,rdx,wd,pos,desc) "nm", &(loc), (rdx), (wd), (pos), 1, (desc), NULL
|
||||
#define BRDATAD(nm,loc,rdx,wd,dep,desc) "nm", (loc), (rdx), (wd), 0, (dep), (desc), NULL
|
||||
#define URDATAD(nm,loc,rdx,wd,off,dep,fl,desc) \
|
||||
"nm", &(loc), (rdx), (wd), (off), (dep), (desc), NULL, ((fl) | REG_UNIT)
|
||||
#define STRDATAD(nm,loc,rdx,wd,off,dep,fl,siz,desc) \
|
||||
"nm", &(loc), (rdx), (wd), (off), (dep), (desc), NULL, ((fl) | REG_STRUCT), (siz)
|
||||
#define ORDATADF(nm,loc,wd,desc,flds) "nm", &(loc), 8, (wd), 0, 1, (desc), (flds)
|
||||
#define DRDATADF(nm,loc,wd,desc,flds) "nm", &(loc), 10, (wd), 0, 1, (desc), (flds)
|
||||
#define HRDATADF(nm,loc,wd,desc,flds) "nm", &(loc), 16, (wd), 0, 1, (desc), (flds)
|
||||
#define FLDATADF(nm,loc,pos,desc,flds) "nm", &(loc), 2, 1, (pos), 1, (desc), (flds)
|
||||
#define GRDATADF(nm,loc,rdx,wd,pos,desc,flds) "nm", &(loc), (rdx), (wd), (pos), 1, (desc), (flds)
|
||||
#define BRDATADF(nm,loc,rdx,wd,dep,desc,flds) "nm", (loc), (rdx), (wd), 0, (dep), (desc), (flds)
|
||||
#define URDATADF(nm,loc,rdx,wd,off,dep,fl,desc,flds) \
|
||||
"nm", &(loc), (rdx), (wd), (off), (dep), (desc), (flds), ((fl) | REG_UNIT)
|
||||
#define STRDATADF(nm,loc,rdx,wd,off,dep,fl,siz,desc,flds) \
|
||||
"nm", &(loc), (rdx), (wd), (off), (dep), (desc), (flds), ((fl) | REG_STRUCT), (siz)
|
||||
#define BIT(nm) {"nm", 0xffffffff, 1} /* Single Bit definition */
|
||||
#define BITNC {"", 0xffffffff, 1} /* Don't care Bit definition */
|
||||
#define BITF(nm,sz) {"nm", 0xffffffff, sz} /* Bit Field definition */
|
||||
|
@ -855,6 +842,23 @@ struct FILEREF {
|
|||
#endif
|
||||
#define ENDBITS {NULL} /* end of bitfield list */
|
||||
|
||||
/* Arrayed register whose data is part of the UNIT structure */
|
||||
#define URDATA(nm,loc,rdx,wd,off,dep,fl) \
|
||||
REGDATA(nm,(loc),(rdx),(wd),(off),(dep),NULL,NULL,((fl) | REG_UNIT),0,0)
|
||||
/* Arrayed register whose data is part of an arbitrary structure */
|
||||
#define STRDATA(nm,loc,rdx,wd,off,dep,siz,fl) \
|
||||
REGDATA(nm,(loc),(rdx),(wd),(off),(dep),NULL,NULL,((fl) | REG_STRUCT),0,(siz))
|
||||
/* Same as above, but with additional description initializer */
|
||||
#define URDATAD(nm,loc,rdx,wd,off,dep,fl,desc) \
|
||||
REGDATA(nm,(loc),(rdx),(wd),(off),(dep),(desc),NULL,((fl) | REG_UNIT),0,0)
|
||||
#define STRDATAD(nm,loc,rdx,wd,off,dep,siz,fl,desc) \
|
||||
REGDATA(nm,(loc),(rdx),(wd),(off),(dep),(desc),NULL,((fl) | REG_STRUCT),0,(siz))
|
||||
/* Same as above, but with additional description initializer, and bitfields */
|
||||
#define URDATADF(nm,loc,rdx,wd,off,dep,fl,desc,flds) \
|
||||
REGDATA(nm,(loc),(rdx),(wd),(off),(dep),(desc),(flds),((fl) | REG_UNIT),0,0)
|
||||
#define STRDATADF(nm,loc,rdx,wd,off,dep,siz,fl,desc,flds) \
|
||||
REGDATA(nm,(loc),(rdx),(wd),(off),(dep),(desc),(flds),((fl) | REG_STRUCT),0,(siz))
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue