summaryrefslogtreecommitdiffstats
path: root/src/build/ifcompiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/build/ifcompiler')
-rwxr-xr-xsrc/build/ifcompiler/initCompiler.C1
-rwxr-xr-xsrc/build/ifcompiler/initCompiler.H1
-rwxr-xr-xsrc/build/ifcompiler/initCompiler.lex99
-rwxr-xr-xsrc/build/ifcompiler/initCompiler.y51
-rwxr-xr-xsrc/build/ifcompiler/initRpn.C70
-rwxr-xr-xsrc/build/ifcompiler/initRpn.H25
-rwxr-xr-xsrc/build/ifcompiler/initScom.C198
-rwxr-xr-xsrc/build/ifcompiler/initScom.H1
-rwxr-xr-xsrc/build/ifcompiler/initSymbols.C203
-rwxr-xr-xsrc/build/ifcompiler/initSymbols.H35
-rwxr-xr-xsrc/build/ifcompiler/makefile7
-rwxr-xr-xsrc/build/ifcompiler/sample.initfile73
12 files changed, 336 insertions, 428 deletions
diff --git a/src/build/ifcompiler/initCompiler.C b/src/build/ifcompiler/initCompiler.C
index 7fc4d1ba6..1f3cc24d6 100755
--- a/src/build/ifcompiler/initCompiler.C
+++ b/src/build/ifcompiler/initCompiler.C
@@ -20,6 +20,7 @@
// dg002 SW039868 dgilbert 10/15/10 Add support to filter unneeded inits by EC
// dg003 D779902 dgilbert 12/08/10 Add ability to specify ouput if file
// andrewg 05/24/11 Port over for VPL/PgP
+// andrewg 09/19/11 Updates based on review
// End Change Log *********************************************************************************
/**
diff --git a/src/build/ifcompiler/initCompiler.H b/src/build/ifcompiler/initCompiler.H
index 6a5e58e18..76eef5782 100755
--- a/src/build/ifcompiler/initCompiler.H
+++ b/src/build/ifcompiler/initCompiler.H
@@ -23,6 +23,7 @@
// dg002 SW039868 dgilbert 10/15/10 Add support to filter unneeded inits by EC
// dg003 D779902 dgilbert 12/08/10 Ability to specify output if file
// andrewg 05/24/11 Port over for VPL/PgP
+// andrewg 09/19/11 Updates based on review
// End Change Log *********************************************************************************
/**
diff --git a/src/build/ifcompiler/initCompiler.lex b/src/build/ifcompiler/initCompiler.lex
index 54e2b5646..2361272f2 100755
--- a/src/build/ifcompiler/initCompiler.lex
+++ b/src/build/ifcompiler/initCompiler.lex
@@ -42,7 +42,7 @@
uint64_t bits2int( const char * bitString);
uint64_t hexs2int(const char * hexString, int32_t size);
-void pushBackSpyBody();
+void pushBackScomBody();
void push_col(const char *s);
void lex_err(const char *s );
@@ -56,12 +56,12 @@ inline void clear_colstream()
{ for( OSS_LIST::iterator i = g_colstream.begin(); i != g_colstream.end(); ++i) delete *i;
g_colstream.clear();
}
-uint32_t g_spycol;
+uint32_t g_scomcol;
uint32_t g_coltype = 0;
-uint32_t g_spytype = 0;
+uint32_t g_scomtype = 0;
uint32_t g_paren_level = 0;
-bool g_equation = false; // equation inside spyv col
-std::string g_spyname; // dg02
+bool g_equation = false; // equation inside scomv col
+std::string g_scomname; // dg02
extern int yyline;
@@ -84,6 +84,7 @@ SCOM_DATA [ ]*[scom_data][ ]+
HEX 0[xX][A-Fa-f0-9]+
SINGLE_HEX [A-Fa-f0-9]
ATTRIBUTE [\[[A-Fa-f0-9]\]]
+MULTI_DIGIT [0-9]+
%x scomop
%x scomop_array
@@ -96,7 +97,6 @@ ATTRIBUTE [\[[A-Fa-f0-9]\]]
%x list
%x enumcol
%x fnames
-%x hier
%x target
%x attribute
%x array
@@ -154,57 +154,56 @@ scom { BEGIN(scomop); oss.str(""); return INIT_SCOM; }
return INIT_SCOM_SUFFIX;
}
-
<scomop>[:;\[] { BEGIN(INITIAL); g_coltype = 0; return yytext[0]; }
<scomop>{NEWLINE} { BEGIN(INITIAL); ++yyline; }
+<scomop,scomop_suffix>[\{] {
+ oss.str("");
+ BEGIN(scomcolname);
+ return yytext[0];
+ }
-when { BEGIN(when_expr); return INIT_WHEN; }
-<when_expr>[\{] { oss.str("");
- BEGIN(scomcolname);
- return yytext[0];
- }
- /* The column & row format is really hard to handle in the parser,
- especially since each column can have different parsing rules.
- So fix it here in the scanner by converting the format to
- coltitle1 , row1, row2, ..., row n ;
- coltitle2 , row1, row2, ..., row n ;
- then push it all back into the input stream and scan the new format
- */
-
-<scomcolname>{COMMENT} ++yyline;
-<scomcolname>\n ++yyline;
-<scomcolname>{ID} {
- g_colstream.push_back(new std::ostringstream());
- *(g_colstream.back()) << yytext;
- }
-<scomcolname>, {}
-<scomcolname>; { BEGIN(scomrow); g_spycol = 0; }
+
+ /* The column & row format is really hard to handle in the parser,
+ * especially since each column can have different parsing rules.
+ * So fix it here in the scanner by converting the format to
+ * coltitle1 , row1, row2, ..., row n ;
+ * coltitle2 , row1, row2, ..., row n ;
+ * then push it all back into the input stream and scan the new format
+ */
+
+<scomcolname>{COMMENT} ++yyline;
+<scomcolname>\n ++yyline;
+<scomcolname>{ID} {
+ g_colstream.push_back(new std::ostringstream());
+ *(g_colstream.back()) << yytext;
+ }
+<scomcolname>, {}
+<scomcolname>; { BEGIN(scomrow); g_scomcol = 0; }
<scomrow>{COMMENT} ++yyline;
<scomrow>{NEWLINE} ++yyline;
<scomrow>[^,;\n#\{\}]+ push_col(yytext);
-<scomrow>[,] ++g_spycol;
-<scomrow>[;] g_spycol = 0;
+<scomrow>[,] ++g_scomcol;
+<scomrow>[;] g_scomcol = 0;
<scomrow>[\}] {
- pushBackSpyBody(); // create new format and put it back on yyin
- BEGIN(INITIAL); // spybody);
- }
-
+ pushBackScomBody(); // create new format and put it back on yyin
+ BEGIN(INITIAL);
+ }
- /* The spybody is the modified format - don't track yyline as it's already
- * accounted for. Any errors in here will point back to the last line in the
- * 'real' spybody */
+ /* The scombody is the modified format - don't track yyline as it's already
+ * accounted for. Any errors in here will point back to the last line in the
+ * 'real' scombody
+ */
-arrayv { g_coltype = INIT_SPYV; return INIT_SPYV;}
-bits { g_coltype = INIT_BITS; return INIT_BITS;}
-expr { g_coltype = INIT_EXPR; return INIT_EXPR;}
-scom_data { g_coltype = INIT_SCOMD; return INIT_SCOMD;}
+bits { g_coltype = INIT_BITS; return INIT_BITS;}
+expr { g_coltype = INIT_EXPR; return INIT_EXPR;}
+scom_data { g_coltype = INIT_SCOMD; return INIT_SCOMD;}
- /*HEX and Binary nubers in the spybody can be up to 64bit,
- * decimal numbers will always fit in 32bit int */
+ /*HEX and Binary nubers in the scombody can be up to 64bit,
+ * decimal numbers will always fit in 32bit int */
{BINARY} { yylval.uint64 = bits2int(yytext); return INIT_INT64; }
@@ -240,9 +239,9 @@ END_INITFILE return INIT_ENDINITFILE;
<*>[\(] { ++g_paren_level; return yytext[0]; }
<*>[\)] { --g_paren_level; return yytext[0]; }
-<*>\[{SINGLE_HEX}\] { yylval.str_ptr = new std::string(yytext); return ATTRIBUTE_INDEX; }
+<*>\[{MULTI_DIGIT}\] { yylval.str_ptr = new std::string(yytext); return ATTRIBUTE_INDEX; }
-<*>[\[\]\{\},:] { g_equation = false; return yytext[0]; }
+<*>[\[\]\{\},:] {g_equation = false; return yytext[0]; }
<*>[ \t\r]+ /* Eat up whitespace */
[\n] { BEGIN(INITIAL);++yyline;}
@@ -308,7 +307,7 @@ uint64_t hexs2int(const char * hexString, int32_t size)
return val;
}
-void pushBackSpyBody()
+void pushBackScomBody()
{
std::ostringstream ost;
for(OSS_LIST::iterator i = g_colstream.begin(); i != g_colstream.end(); ++i)
@@ -336,18 +335,18 @@ void pushBackSpyBody()
void push_col(const char * s)
{
//dg02a begin
- while(g_spycol >= g_colstream.size()) // more data cols than headers cols
+ while(g_scomcol >= g_colstream.size()) // more data cols than headers cols
{
// This will force an error in the parser where it can stop the compile.
g_colstream.push_back(new std::ostringstream());
*(g_colstream.back()) << "MISSING_COLUMN_HEADER";
- lex_err(g_spyname.c_str());
- lex_err("Invalid number of spy cols");
+ lex_err(g_scomname.c_str());
+ lex_err("Invalid number of scom cols");
}
//dgxxa end
//dgxxd remove if(g_colstream < g_colstream.size()
- std::ostringstream & o = *(g_colstream[g_spycol]);
+ std::ostringstream & o = *(g_colstream[g_scomcol]);
std::ostringstream token;
std::istringstream iss(s);
std::string t;
diff --git a/src/build/ifcompiler/initCompiler.y b/src/build/ifcompiler/initCompiler.y
index 5c5ab0a3f..689a5f384 100755
--- a/src/build/ifcompiler/initCompiler.y
+++ b/src/build/ifcompiler/initCompiler.y
@@ -74,24 +74,16 @@ int scom;
%token <uint64> INIT_SCOM_DATA
%token <str_ptr> INIT_ID
%token <str_ptr> INIT_VERSIONS
-%token <str_ptr> INIT_SPY_NAME
%token <str_ptr> ATTRIBUTE_INDEX
/* Define terminal symbols that don't have any associated data */
-%token INIT_WHEN
%token INIT_VERSION
%token INIT_ENDINITFILE
-%token INIT_ESPY
-%token INIT_ISPY
-%token INIT_ARRAY
-%token INIT_SPYV
-%token INIT_ARRAYV
%token INIT_BITS
%token INIT_EXPR
%token INIT_TARG
-%token INIT_HIER
%token INIT_DEFINE
%token INIT_EQ
%token INIT_NE
@@ -107,13 +99,12 @@ int scom;
%type <str_ptr> bitsrows
%type <rpn_ptr> expr id_col num_list
-%type <str_ptr> hier_list
- /* top is lowest precedent - done last */
+/* top is lowest precedent - done last */
%left INIT_LOGIC_OR
%left INIT_LOGIC_AND
%left '|' /* bitwise OR */
@@ -124,9 +115,8 @@ int scom;
%left INIT_SHIFT_RIGHT INIT_SHIFT_LEFT
%left '-' '+'
%left '*' '/' '%'
-%right '!' '~' /* logic negation bitwise complemnet*/
-
- /* bottom is highest precedent - done first */
+%right '!' '~' /* logic negation bitwise complement*/
+/* bottom is highest precedent - done first */
@@ -142,7 +132,6 @@ line: scom
| cvs_versions
| syntax_version
| define
- | hierarchy
| INIT_ENDINITFILE { yyscomlist->clear_defines(); }
;
@@ -160,7 +149,7 @@ syntax_version: INIT_VERSION '=' INIT_INTEGER
;
scom: INIT_SCOM {current_scom = new init::Scom(yyscomlist->get_symbols(),yyline);}
- | scom scomaddr '[' when_expr ']' '{' scombody '}'
+ | scom scomaddr '{' scombody '}'
{
/* printf("Found an INIT_SCOM!\n"); */
/* current_scom = new init::Scom(yyscomlist->get_symbols(),yyline); */
@@ -182,18 +171,8 @@ scom_list: INIT_INT64_STR { current_scom->dup_scom_address(
| scom_list ',' INIT_INT64_STR { current_scom->dup_scom_address(*($3));delete $3;}
;
-when_expr: INIT_WHEN '=' INIT_ID { current_scom->set_when($3); delete $3; }
- | INIT_WHEN '=' INIT_ID INIT_LOGIC_AND expr
- {
- init::dbg << $5->listing("Length of when RPN");
- current_scom->set_when($3);
- current_scom->set_when_rpn($5);
- delete $3;
- }
-
-;
- /* The spybody was reformatted by the scanner
+ /* The scombody was reformatted by the scanner
* colname1 , row1 , row 2, ... , row n ;
* colname2 , row1 , row 2, ... , row n ;
*/
@@ -215,7 +194,7 @@ scombodyline: INIT_SCOMD ',' scomdrows {}
scomdrows: expr {
- /* printf("scomdrows - RPN Address:0x%X\n",$1); */
+ /*printf("scomdrows - RPN Address:0x%X\n",$1);*/
init::dbg << $1->listing("Length scom RPN");
current_scom->add_scom_rpn($1);
}
@@ -263,11 +242,6 @@ num_list: INIT_INTEGER { $$ = new init::Rpn($1,yyscomlist->get_symbols());
;
-
- /* first col is spyv/arrayv and is special from the other rowcols */
-
-
-
define: INIT_DEFINE INIT_ID '=' expr ';'
{
init::dbg << $2 << ':' << endl << $4->listing("Length of rpn for Define");
@@ -276,23 +250,10 @@ define: INIT_DEFINE INIT_ID '=' expr ';'
}
;
-
-hierarchy: INIT_HIER '=' hier_list
- | INIT_HIER '[' INIT_ID ']' '=' hier_list { delete $3; } // not supported
-;
-
-hier_list: INIT_SPY_NAME { delete $1; }
- | INIT_ID { delete $1; } // not supported
- | hier_list ',' INIT_SPY_NAME { delete $3; }
- | hier_list ',' INIT_ID { delete $3; } // not supported
-;
-
-
/* expr should return an RPN string of some kind */
expr: INIT_INTEGER { $$= new init::Rpn($1,yyscomlist->get_symbols()); }
| INIT_ID { $$= new init::Rpn(*($1),yyscomlist->get_symbols()); delete $1; }
| INIT_INT64 { $$=new init::Rpn($1,yyscomlist->get_symbols()); }
- | INIT_SPY_NAME { $$=new init::Rpn(*($1),yyscomlist->get_symbols(),init::Rpn::SPY_ENUM); delete $1; }
| expr INIT_LOGIC_OR expr { $$ = $1->push_merge($3,init::Rpn::OR); }
| expr INIT_LOGIC_AND expr { $$ = $1->push_merge($3,init::Rpn::AND); }
| expr ATTRIBUTE_INDEX { $1->push_array_index(*($2));}
diff --git a/src/build/ifcompiler/initRpn.C b/src/build/ifcompiler/initRpn.C
index 837679273..f4ffd1c54 100755
--- a/src/build/ifcompiler/initRpn.C
+++ b/src/build/ifcompiler/initRpn.C
@@ -20,6 +20,7 @@
// dg002 SW039868 dgilbert 10/15/10 Add support to filter unneeded inits by EC
// dg003 SW047506 dgilbert 12/09/10 SERIES filtering
// andrewg 05/24/11 Port over for VPL/PgP
+// andrewg 09/19/11 Updates based on review
// End Change Log *********************************************************************************
/**
@@ -65,7 +66,7 @@ std::string Rpn::cv_empty_str;
//-------------------------------------------------------------------------------------------------
Rpn::Rpn(uint32_t i_uint,Symbols * symbols) : iv_symbols(symbols)
-{ push_int(i_uint); }
+{ push_int(i_uint);}
//-------------------------------------------------------------------------------------------------
@@ -139,7 +140,6 @@ bool Rpn::operator==(const Rpn & r)
if(data1 != data2) result = false;
}
break;
- case SPY_ENUM: // independent of symbol table - just compare
case OPERATION: // independent of symbol table - just compare
default: // just compare
if(*c1 != *c2) result = false;
@@ -176,18 +176,12 @@ void Rpn::push_id(std::string & i_id, TYPE i_type)
std::string s(i_id);
for (std::string::iterator c = s.begin(); c != s.end(); ++c)
- *c = toupper(*c);
-
- if (i_type == SPY_ENUM)
- {
- // don't always have complete spyname at this point
- rpn_id = iv_symbols->use_enum(s);
- }
- else
{
- rpn_id = iv_symbols->use_symbol(s);
+ *c = toupper(*c);
}
+ rpn_id = iv_symbols->use_symbol(s);
+
if (rpn_id & DEFINE)
{
Rpn r = iv_symbols->get_define_rpn(rpn_id);
@@ -203,7 +197,16 @@ void Rpn::push_id(std::string & i_id, TYPE i_type)
void Rpn::push_array_index(std::string &i_array_idx)
{
- printf("Array Index: %s\n",i_array_idx.c_str());
+ string l_idx = i_array_idx;
+ // strip of leading "[" and last "]"
+ l_idx = l_idx.substr(1,(l_idx.length() - 2));
+ uint32_t l_array_val = atoi(l_idx.c_str());
+
+ uint32_t rpn_id = iv_symbols->find_numeric_array_lit(l_array_val,4);
+ iv_rpnstack.push_back(rpn_id);
+
+ //printf("Array Index: %s decimal:%u rpn_id:0x%8X\n",l_idx.c_str(),l_array_val,rpn_id);
+
}
//-------------------------------------------------------------------------------------------------
@@ -468,9 +471,12 @@ Rpn * Rpn::merge(Rpn * i_rpn)
// See header file for contract
void Rpn::bin_read(BINSEQ::const_iterator & bli, Symbols * symbols)
{
+
+ uint32_t size = 2; // Size is always 2 for symbols
+
if(symbols) iv_symbols = symbols;
iv_rpnstack.clear();
- uint32_t size = *bli++;
+
while(size)
{
uint32_t v = *bli++;
@@ -602,19 +608,6 @@ std::string Rpn::listing(const char * i_desc, const std::string & spyname, bool
oss << "0x" << std::setw(size * 2) << data << '\t' << "Numerica Literal" << std::endl;
}
}
- else if((*i) & SPY_ENUM)
- {
- if(i_final)
- {
- oss << "0x" << std::setw(8) << iv_symbols->get_spy_enum_id(*i,spyname)
- << '\t' << iv_symbols->get_enum_name(*i) << std::endl;
- }
- else
- {
- //oss << "0x" << std::setw(8) << *i << '\t'
- oss << iv_symbols->get_enum_name(*i) << std::endl;
- }
- }
else if((*i) & SYMBOL)
{
std::string name = iv_symbols->find_name(*i);
@@ -650,14 +643,14 @@ std::string Rpn::listing(const char * i_desc, const std::string & spyname, bool
}
}
- if((iv_rpnstack.size() == 1) && ((iv_rpnstack.front() & SPY_ENUM) || (iv_rpnstack.front() & SYMBOL))) // skip size and desc
+ if((iv_rpnstack.size() == 1) && (iv_rpnstack.front() & SYMBOL)) // skip size and desc
{
odesc << oss.str();
}
else
{
odesc << std::hex << std::setfill('0')
- << "0x" << std::setw(2) << rpn_byte_size << "\t\t";
+ << "0x" << std::setw(4) << rpn_byte_size << "\t\t";
if(i_desc) odesc << i_desc;
else odesc << std::dec << rpn_byte_size << " BYTES";
odesc << std::endl;
@@ -703,24 +696,19 @@ void Rpn::bin_str(BINSEQ & o_blist, bool i_prepend_count) // binary version to
blist.push_back((uint8_t) tag);
count += 2;
break;
-// Not supported
-#if 0
- case SPY_ENUM: v = iv_symbols->get_spy_enum_id(v,spyname);
- blist.push_back((uint8_t)(v >> 24));
- blist.push_back((uint8_t)(v >> 16));
- blist.push_back((uint8_t)(v >> 8));
- blist.push_back((uint8_t) v);
- count += 4;
+ case ARRAY_INDEX:
+ tag = iv_symbols->get_numeric_array_tag(v);
+ blist.push_back((uint8_t)(tag >> 8));
+ blist.push_back((uint8_t) tag);
+ count += 2;
break;
-#endif
+
default:
std::cerr << "ERROR! Rpn::bit_str() Invalid Rpn type: " << v << std::endl;
break;
}
}
- if(iv_rpnstack.size() == 1 && (iv_rpnstack.front() & SPY_ENUM)) i_prepend_count = false; // never for SPY ENUMS
-
if (i_prepend_count)
{
o_blist.push_back((uint8_t) count);
@@ -1020,10 +1008,6 @@ bool Rpn::resolve(SYMBOL_VAL_LIST & i_varlist)
uint64_t data = iv_symbols->get_numeric_data(*i,size);
stack.push_back(RPN_VALUE(data,RPN_NUMBER));
}
- else if((*i) & SPY_ENUM)
- {
- //TODO - don't care about spy enums for now
- }
else if((*i) & SYMBOL) // variables and cini enums
{
std::string name = iv_symbols->find_name(*i);
diff --git a/src/build/ifcompiler/initRpn.H b/src/build/ifcompiler/initRpn.H
index 93d6433a2..5bd98a3fa 100755
--- a/src/build/ifcompiler/initRpn.H
+++ b/src/build/ifcompiler/initRpn.H
@@ -23,6 +23,7 @@
// dgilbert 10/15/10 Add support to filter unneeded inits by EC
// dg002 SW039868 dgilbert 10/15/10 Add support to filter unneeded inits by EC
// dg003 SW047506 dgilbert 12/09/10 SERIES filtering
+// andrewg 09/19/11 Updates based on review
// End Change Log *********************************************************************************
/**
@@ -51,13 +52,13 @@ namespace init
enum TYPE
{
- DEFINE = 0x08000000,
- SYMBOL = 0x10000000,
- NUMBER = 0x20000000,
- SPY_ENUM = 0x40000000,
- OPERATION = 0x80000000,
- TYPE_MASK = 0xF8000000,
- OP_MASK = 0x000000FF
+ DEFINE = 0x08000000,
+ SYMBOL = 0x10000000,
+ NUMBER = 0x20000000,
+ ARRAY_INDEX = 0x40000000,
+ OPERATION = 0x80000000,
+ TYPE_MASK = 0xF8000000,
+ OP_MASK = 0x000000FF
};
@@ -189,13 +190,15 @@ namespace init
std::string symbol_names() const; //<<< Return a string of all the SYMBOL names in the Rpn
/**
- * binary string of RPN to write to file
- * @return blist appended with binary string of this Rpn
- * @param flag to prepend rpn count to binary string
+ * @brief Push all RPN stack entries of object as numerical values onto input blist
+ *
+ * @param blist Binary string of RPN to write to file
+ * @param i_prepend_count Flag to indicate prepend rpn count to binary string
* @PRE should never be called until all symbols in the initfile have been
* "looked up" or the binary tags for Symbols and Numbers may not be accurate
+ * @return void
*/
- void bin_str(BINSEQ & blist, bool i_prepend_count = true);
+ void bin_str(BINSEQ & blist, bool i_prepend_count = false);
/**
* Read binary sequence to recreate this Rpn sequence
diff --git a/src/build/ifcompiler/initScom.C b/src/build/ifcompiler/initScom.C
index 71c4459a3..6b9e3ae67 100755
--- a/src/build/ifcompiler/initScom.C
+++ b/src/build/ifcompiler/initScom.C
@@ -22,6 +22,7 @@
// dg002 SW039868 dgilbert 10/15/10 Add support to filter unneeded inits by EC
// dg003 SW047506 dgilbert 12/09/10 More filtering enhancements
// andrewg 05/24/11 Port over for VPL/PgP
+// andrewg 09/19/11 Updates based on review
// End Change Log *********************************************************************************
/**
@@ -67,15 +68,11 @@ Scom::Scom(BINSEQ::const_iterator & bli, Symbols * i_symbols):
uint32_t id = Rpn::extract16(bli);
uint32_t numcols = Rpn::extract16(bli);
uint32_t numrows = Rpn::extract16(bli);
- //uint32_t hier = *bli++;
- ++bli; // don't need hier
- //iv_when |= numcols & SUBTYPE_MASK;
numcols &= ~SUBTYPE_MASK;
// Get our SCOM address
uint32_t l_addr_size = 0;
- //iv_scom_addr[0] = iv_symbols->get_numeric_data(iv_symbols->get_rpn_id(id),l_addr_size);
iv_scom_addr_hex = iv_symbols->get_numeric_data(iv_symbols->get_rpn_id(id),l_addr_size);
@@ -94,10 +91,6 @@ Scom::Scom(BINSEQ::const_iterator & bli, Symbols * i_symbols):
}
}
- // when Rpn iv_when_rpn
- //iv_when_rpn.bin_read(bli);
-
- //
for(size_t i = 0; i < numrows; ++i)
{
Rpn rpn(bli,iv_symbols);
@@ -324,18 +317,6 @@ string Scom::list_one(RANGE range)
}
else numrows = allrows; // else select all the rows
- uint32_t hierarchy = 0xFF;
-#if 0
- for(SPY_NAMES::iterator hier = cv_hier_list.begin(); hier != cv_hier_list.end(); ++hier)
- {
- if((spyname.length() > hier->length()) && (spyname.compare(0,hier->length(),*hier) == 0))
- {
- char c = spyname[hier->length()];
- if(isdigit(c)) hierarchy = c - '0';
- break;
- }
- }
-#endif
oss << hex << setfill('0');
oss << "------------";
oss << " Scom Address: 0x" << setw(16) << iv_scom_addr_hex;
@@ -354,9 +335,7 @@ string Scom::list_one(RANGE range)
//oss << "0x" << setw(8) << iv_symbols->get_spy_id(spyname) << '\t';
oss << "0x" << setw(4) << numcols << "\t\t" << "Number of columns" << endl
- << "0x" << setw(4) << numrows << "\t\t" << "Number of rows" << endl
- << "0x" << setw(2) << hierarchy << "\t\t" << "Hierarchy Instance\n" << endl;
- //<< iv_when_rpn.listing("Length of when RPN",spyname,true) << endl;
+ << "0x" << setw(4) << numrows << "\t\t" << "Number of rows" << endl;
// If there is a bit range we need to select only the spyv rows that apply to this spyname
@@ -380,11 +359,11 @@ string Scom::list_one(RANGE range)
}
oss << endl;
-#if 0
+
// list the column names that are really CINI VARS
for(RPN_LIST::iterator i = iv_col_vars.begin(); i != iv_col_vars.end(); ++i)
{
- oss << i->listing("",spyname,true);
+ oss << i->listing("",Rpn::cv_empty_str,true);
//Rpn col_rpn = *i;
//string desc = iv_symbols->find_name(rpn_id);
//if(desc.size() == 0) desc = "Variable not found!";
@@ -393,7 +372,7 @@ string Scom::list_one(RANGE range)
}
oss << endl << endl;
-#endif
+
uint32_t usedrows = 0;
if(iv_cols_rpn.size() == 0)
@@ -466,6 +445,7 @@ uint32_t Scom::bin_listing(BINSEQ & blist)
for(; i != iv_scom_addr.end(); ++i)
{
+ //printf("scom address:%s\n",(*i).c_str());
if(ranges.size())
{
for(set<RANGE>::iterator r = ranges.begin(); r != ranges.end(); ++r)
@@ -525,21 +505,6 @@ void Scom::bin_list_one(BINSEQ & blist,uint64_t i_addr, RANGE range)
}
else numrows = allrows; // else select all the rows
-
- uint32_t hierarchy = 0xFF;
-// No hierarchy support
-#if 0
- for(SPY_NAMES::iterator hier = cv_hier_list.begin(); hier != cv_hier_list.end(); ++hier)
- {
- if((spyname.length() > hier->length()) && (spyname.compare(0,hier->length(),*hier) == 0))
- {
- char c = spyname[hier->length()];
- if(isdigit(c)) hierarchy = c - '0';
- break;
- }
- }
-#endif
-
// If every row rpn in a column is unconditionally true then remove the col.
if(iv_col_vars.size())
{
@@ -588,22 +553,8 @@ void Scom::bin_list_one(BINSEQ & blist,uint64_t i_addr, RANGE range)
delete l_scom_addr;
-// TODO - No Array support
-#if 0
- if(iv_spy_type == ARRAY)
- {
- Rpn::set32(blist,iv_array_addr);
- }
-#endif
-
Rpn::set16(blist,(uint16_t)numcols);
Rpn::set16(blist,(uint16_t)numrows);
- blist.push_back((uint8_t) hierarchy);
-
-#if 0
-
- iv_when_rpn.bin_str(blist,spyname);
-#endif
// If there is a bit range we need to select only the spyv rows that apply to this spyname
if(bitlen)
@@ -613,7 +564,7 @@ void Scom::bin_list_one(BINSEQ & blist,uint64_t i_addr, RANGE range)
{
if ((*r) == range)
{
- i->bin_str(blist);
+ i->bin_str(blist,false);
}
}
}
@@ -621,7 +572,7 @@ void Scom::bin_list_one(BINSEQ & blist,uint64_t i_addr, RANGE range)
{
for(RPN_LIST::iterator i = iv_scom_rpn.begin(); i != iv_scom_rpn.end(); ++i)
{
- i->bin_str(blist);
+ i->bin_str(blist,false);
}
}
@@ -650,7 +601,7 @@ void Scom::bin_list_one(BINSEQ & blist,uint64_t i_addr, RANGE range)
{
rpn.append(i->at(n));
}
- rpn.bin_str(blist);
+ rpn.bin_str(blist,true);
}
}
}
@@ -1038,10 +989,7 @@ void ScomList::set_syntax_version(uint32_t v)
void ScomList::compile(BINSEQ & bin_seq)
{
- uint32_t count_l = 0;
uint32_t count_s = 0;
- uint32_t count_c = 0;
- uint32_t count_d = 0;
uint32_t section_count = 0;
size_t offset = 0;
@@ -1113,25 +1061,13 @@ void ScomList::compile(BINSEQ & bin_seq)
continue;
}
- if (i->second->do_when(LONG_SCAN)) count_l += i->second->bin_listing(blist_l);
- else if(i->second->do_when(SCOM)) count_s += i->second->bin_listing(blist_s);
- else if(i->second->do_when(CFAMINIT)) count_c += i->second->bin_listing(blist_c);
- else if(i->second->do_when(DRAMINIT)) count_d += i->second->bin_listing(blist_d);
- else
- {
- ostringstream oss;
- oss << "ERROR: Invalid 'when=' type:\n"
- << i->second->listing();
- throw range_error(oss.str());
- }
+ count_s += i->second->bin_listing(blist_s);
}
- if(count_l) ++section_count;
if(count_s) ++section_count;
- if(count_c) ++section_count;
- if(count_d) ++section_count;
- offset = bin_seq.size() + 12 + (12 * section_count); // offset to the end of the header section
+ // 28 bytes of File Header Data
+ offset = 28;
stats << '*' << setw(20) << "Sections:" << setw(6) << section_count << endl;
// for verion 2 add offset to CVS versions section
@@ -1150,34 +1086,11 @@ void ScomList::compile(BINSEQ & bin_seq)
offset += blist_v.size(); // offset += var table byte size
Rpn::set32(bin_seq,offset); // Offset to Literal Symbol Table
offset += blist_i.size(); // offset += lit table byte size
- Rpn::set32(bin_seq,section_count); // Number of Spy Sections
- if(count_l)
- {
- Rpn::set32(bin_seq,LONG_SCAN); // Spy Section Type (L)
- Rpn::set32(bin_seq,offset); // Spy Section Type L Offset
- Rpn::set32(bin_seq,count_l); // Number of L spies
- offset += blist_l.size(); // offset += byte size of when=L tables
- }
- if(count_c)
- {
- Rpn::set32(bin_seq,CFAMINIT); // Spy Section Type (C)
- Rpn::set32(bin_seq,offset); // Spy Section Type L Offset
- Rpn::set32(bin_seq,count_c); // Number of L spies
- offset += blist_c.size(); // offset += byte size of when=L tables
- }
- if(count_d)
- {
- Rpn::set32(bin_seq,DRAMINIT); // Spy Section Type (D)
- Rpn::set32(bin_seq,offset); // Spy Section Type L Offset
- Rpn::set32(bin_seq,count_d); // Number of L spies
- offset += blist_d.size(); // offset += byte size of when=L tables
- }
if(count_s)
{
- Rpn::set32(bin_seq,SCOM); // Spy Section Type (S)
- Rpn::set32(bin_seq,offset); // Spy Section Type S Offset
- Rpn::set32(bin_seq,count_s); // Number of S spies
+ Rpn::set32(bin_seq,offset); // SCOM Section offset
+ Rpn::set32(bin_seq,count_s); // Number of SCOM's
}
if(iv_syntax_version == 2) // Add Sub-version section
@@ -1188,24 +1101,10 @@ void ScomList::compile(BINSEQ & bin_seq)
bin_seq.insert(bin_seq.end(), blist_v.begin(), blist_v.end()); // add var table section
bin_seq.insert(bin_seq.end(), blist_i.begin(), blist_i.end()); // add lit table section
- if(count_l)
- {
- bin_seq.insert(bin_seq.end(), blist_l.begin(), blist_l.end()); // add when=L spies
- stats << '*' << setw(20) << "L scoms:" << setw(6) << count_l << endl;
- }
- if(count_c)
- {
- bin_seq.insert(bin_seq.end(), blist_c.begin(), blist_c.end()); // add when=C spies
- stats << '*' << setw(20) << "C scoms:" << setw(6) << count_c << endl;
- }
- if(count_d)
- {
- bin_seq.insert(bin_seq.end(), blist_d.begin(), blist_d.end()); // add when=D spies
- stats << '*' << setw(20) << "D scoms:" << setw(6) << count_d << endl;
- }
+
if(count_s)
{
- bin_seq.insert(bin_seq.end(), blist_s.begin(), blist_s.end()); // add when=S spies
+ bin_seq.insert(bin_seq.end(), blist_s.begin(), blist_s.end()); // add SCOM section
stats << '*' << setw(20) << "S scoms:" << setw(6) << count_s << endl;
}
dbg << "======================== End compile ============================" << endl;
@@ -1276,11 +1175,9 @@ void ScomList::listing(BINSEQ & bin_seq,ostream & olist)
uint32_t var_table_offset = Rpn::extract32(bli);
uint32_t lit_table_offset = Rpn::extract32(bli);
- uint32_t section_count = Rpn::extract32(bli);
- olist << fmt8(var_table_offset) << "[Offset to Variable Symbol Table]\n";
+ olist << fmt8(var_table_offset) << "[Offset to Attribute Symbol Table]\n";
olist << fmt8(lit_table_offset) << "[Offset to Literal Symbol Table]\n";
- olist << fmt8(section_count) << "[Number of Scom Sections]\n";
b = bin_seq.begin() + var_table_offset;
@@ -1289,29 +1186,14 @@ void ScomList::listing(BINSEQ & bin_seq,ostream & olist)
b = bin_seq.begin() + lit_table_offset;
iv_symbols->restore_lit_bseq(b);
- if(section_count > LAST_WHEN_TYPE)
- {
- throw range_error("ERROR: ScomList::listing - Inalid # of sections");
- }
-
b = bli; // save
- for(size_t i = 0; i < section_count; ++i)
- {
- size_t spy_type = Rpn::extract32(bli); // type
- size_t offset = Rpn::extract32(bli); // offset
- size_t count = Rpn::extract32(bli); // Number of spies
+ size_t offset = Rpn::extract32(bli); // offset
+ size_t count = Rpn::extract32(bli); // Number of spies
- if(spy_type == 0 || spy_type > LAST_WHEN_TYPE)
- {
- throw range_error("ERROR: ScomList::listing - when= type out of range");
- }
- char t = when_char[spy_type];
+ olist << fmt8(offset) << "[Scom Section Offset]\n";
+ olist << fmt8(count) << "[Number of scoms]\n";
- olist << fmt8(spy_type) << "[Scom Section Type (" << t << ")]\n";
- olist << fmt8(offset) << "[Scom Section Type (" << t << ") Offset]\n";
- olist << fmt8(count) << "[Number of " << t << " scoms]\n";
- }
olist << endl;
if(syntax_version == 2)
@@ -1329,34 +1211,20 @@ void ScomList::listing(BINSEQ & bin_seq,ostream & olist)
<< endl;
bli = b; // restore
- for(size_t i = 0; i < section_count; ++i)
- {
-
- size_t scom_type = Rpn::extract32(bli); // type
- size_t offset = Rpn::extract32(bli); // offset
- size_t count = Rpn::extract32(bli); // Number of scoms
-
-
- if(scom_type == 0 || scom_type > LAST_WHEN_TYPE)
- {
- throw range_error("ERROR: ScomList::listing - when= type out of range");
- }
- char t = when_char[scom_type];
- olist << "------------ " << t << " Scoms -----------\n\n";
+ olist << "------------ Scoms -----------\n\n";
- b = bin_seq.begin() + offset;
- if(!(b < bin_seq.end()))
- {
- throw overflow_error("ERROR: ScomList::listing - iterator overflowed sequence");
- }
- while(count--)
- {
- Scom s(b,iv_symbols);
- s.set_when((SCOM_WHEN)scom_type);
- olist << s.listing() << endl;
- }
+ b = bin_seq.begin() + offset;
+ if(!(b < bin_seq.end()))
+ {
+ throw overflow_error("ERROR: ScomList::listing - iterator overflowed sequence");
+ }
+ while(count--)
+ {
+ Scom s(b,iv_symbols);
+ olist << s.listing() << endl;
}
+
dbg << "======================= End Listing ========================" << endl;
}
@@ -1367,7 +1235,7 @@ string ScomList::fmt8(uint32_t val)
ostringstream oss;
oss << setfill('0');
oss << "0x" << hex << setw(8) << val << "\t " << '[' << dec << val << ']' << '\t';
- if(val < 100) oss << '\t';
+ if(val < 1000) oss << '\t';
return oss.str();
}
diff --git a/src/build/ifcompiler/initScom.H b/src/build/ifcompiler/initScom.H
index 8ce65c76b..14f53bef0 100755
--- a/src/build/ifcompiler/initScom.H
+++ b/src/build/ifcompiler/initScom.H
@@ -23,6 +23,7 @@
// dg002 SW039868 dgilbert 10/15/10 Add support to filter unneeded inits by EC
// dg003 SW047506 dgilbert 12/09/10 More filtering enhancements
// andrewg 05/24/11 Port over for VPL/PgP
+// andrewg 09/19/11 Updates based on review
// End Change Log *********************************************************************************
/**
diff --git a/src/build/ifcompiler/initSymbols.C b/src/build/ifcompiler/initSymbols.C
index 994b96d6c..a09421be8 100755
--- a/src/build/ifcompiler/initSymbols.C
+++ b/src/build/ifcompiler/initSymbols.C
@@ -14,10 +14,11 @@
// IBM_PROLOG_END_TAG
// Change Log *************************************************************************************
//
-// Flag Track Userid Date Description
-// ---- -------- -------- -------- -------------------------------------------------------------
-// D754106 dgilbert 06/14/10 Create
-// dgilbert 10/22/10 Add spies_are_in()
+// Flag Track Userid Date Description
+// ---- -------- -------- -------- -------------------------------------------------------------
+// D754106 dgilbert 06/14/10 Create
+// dgilbert 10/22/10 Add spies_are_in()
+// andrewg 09/19/11 Updates based on review
// End Change Log *********************************************************************************
/**
@@ -69,36 +70,40 @@ Symbols::Symbols(FILELIST & i_filenames)
//printf("def: %s\n",def.c_str());
if(def == "enum")
{
-
- // We've now found the beginning of the attribute enum definition
- // Read and skip the { on the next line
- getline(infs,fileline);
- getline(infs,fileline);
-
- // We're just parsing the enum in order so values start
- // at 0 and increment by 1 after that.
- uint32_t value = 0;
-
- while(fileline[0] != '}')
+ // Make sure it's the AttributeId enum
+ iss >> def;
+ if(def == "AttributeId")
{
- istringstream attr_stream(fileline);
- string attr;
- attr_stream >> attr;
+ // We've now found the beginning of the attribute enum definition
+ // Read and skip the { on the next line
+ getline(infs,fileline);
+ getline(infs,fileline);
+
+ // We're just parsing the enum in order so values start
+ // at 0 and increment by 1 after that.
+ uint32_t value = 0;
- // Strip off the "," at the end.
- size_t pos = attr.find(',');
- if(pos != string::npos)
+ while(fileline[0] != '}')
{
- attr = attr.substr(0,attr.length()-1);
- }
+ istringstream attr_stream(fileline);
+ string attr;
+ attr_stream >> attr;
- //printf("Attribute String:%s\n",attr.c_str());
- // We now have the first attribute loaded into attr
- // Get a value for the string
+ // Strip off the "," at the end.
+ size_t pos = attr.find(',');
+ if(pos != string::npos)
+ {
+ attr = attr.substr(0,attr.length()-1);
+ }
- iv_symbols[attr] = MAP_DATA(value,NOT_USED);
- value++;
- getline(infs,fileline);
+ //printf("Attribute String:%s\n",attr.c_str());
+ // We now have the first attribute loaded into attr
+ // Get a value for the string
+
+ iv_symbols[attr] = MAP_DATA(value,NOT_USED);
+ value++;
+ getline(infs,fileline);
+ }
}
}
else if(def == "typedef")
@@ -106,6 +111,8 @@ Symbols::Symbols(FILELIST & i_filenames)
string type;
string attribute_name;
string find_type = "_Type";
+ string find_array = "[";
+ bool array = false;
iss >> type;
iss >> attribute_name;
if(attribute_name == "*")
@@ -116,11 +123,18 @@ Symbols::Symbols(FILELIST & i_filenames)
}
//printf("typedef: type:%s attribute_name:%s\n",type.c_str(),attribute_name.c_str());
+ // Check if there's a "[" in the string, which would indicate it's an array
+ size_t pos = attribute_name.find(find_array);
+ if(pos != string::npos)
+ {
+ array = true;
+ }
+
// Now strip off the _type in the name
- size_t pos = attribute_name.find(find_type);
+ pos = attribute_name.find(find_type);
if(pos != string::npos)
{
- attribute_name = attribute_name.substr(0,attribute_name.length()- strlen("_Type") - 1);
+ attribute_name = attribute_name.substr(0,pos);
}
else
{
@@ -128,10 +142,8 @@ Symbols::Symbols(FILELIST & i_filenames)
exit(1);
}
- //printf("typedef: type:%s attribute_name:%s\n",type.c_str(),attribute_name.c_str());
-
- iv_attr_type[attribute_name] = get_attr_type(type);
- //printf("Type for %s is %u\n",type.c_str(),get_attr_type(type));
+ iv_attr_type[attribute_name] = get_attr_type(type,array);
+ //printf("Attribute %s Type for %s is %u\n",attribute_name.c_str(),type.c_str(),get_attr_type(type,array));
}
}
infs.close();
@@ -140,29 +152,48 @@ Symbols::Symbols(FILELIST & i_filenames)
iv_rpn_map[Rpn::SYMBOL | INIT_ANY_LIT] = RPN_DATA("ANY",CINI_LIT_MASK);
}
-uint32_t Symbols::get_attr_type(const string &i_type)
+uint32_t Symbols::get_attr_type(const string &i_type, bool i_array)
{
if (i_type == "uint8_t")
{
- return(SYM_ATTR_UINT8_TYPE);
+ if(i_array == true)
+ {
+ return(SYM_ATTR_UINT8_ARRAY_TYPE);
+ }
+ else
+ {
+ return(SYM_ATTR_UINT8_TYPE);
+ }
}
else if(i_type == "uint32_t")
{
- return(SYM_ATTR_UINT32_TYPE);
+ if(i_array == true)
+ {
+ return(SYM_ATTR_UINT32_ARRAY_TYPE);
+ }
+ else
+ {
+ return(SYM_ATTR_UINT32_TYPE);
+ }
}
else if(i_type == "uint64_t")
{
- return(SYM_ATTR_UINT64_TYPE);
- }
- else if(i_type == "char*")
- {
- return(SYM_ATTR_STRING_TYPE);
+ if(i_array == true)
+ {
+ return(SYM_ATTR_UINT64_ARRAY_TYPE);
+ }
+ else
+ {
+ return(SYM_ATTR_UINT64_TYPE);
+ }
}
+ //else if(i_type == "uint64_t")
+ // TODO - Add attribute array support
else
{
// TODO - Need to ensure all attributes have data type at the end of processing
- //printf("Unknown data type: %s\n",i_type.c_str());
+ printf("Unknown data type: %s\n",i_type.c_str());
return(0);
}
@@ -398,6 +429,24 @@ uint32_t Symbols::find_numeric_lit(uint64_t i_data, int32_t byte_size)
return offset | Rpn::NUMBER;
}
+uint32_t Symbols::find_numeric_array_lit(uint64_t i_data, int32_t byte_size)
+{
+ uint32_t offset = 0;
+ LIT_LIST::iterator i = iv_lits.begin();
+ for(; i != iv_lits.end(); ++i,++offset)
+ {
+ if(i_data == i->first && (uint32_t)byte_size == i->second)
+ break;
+ }
+ if(i == iv_lits.end())
+ {
+ iv_lits.push_back(LIT_DATA(i_data,byte_size));
+ }
+ //printf("Symbols::find_numeric_lit: i_data:0x%llX byte_size:%d Tag:0x%X\n",
+ // i_data,byte_size, offset | Rpn::NUMBER);
+ return offset | Rpn::ARRAY_INDEX;
+}
+
// ------------------------------------------------------------------------------------------------
uint16_t Symbols::get_numeric_tag(uint32_t i_rpn_id)
@@ -423,6 +472,29 @@ uint16_t Symbols::get_numeric_tag(uint32_t i_rpn_id)
// ------------------------------------------------------------------------------------------------
+uint16_t Symbols::get_numeric_array_tag(uint32_t i_rpn_id)
+{
+ uint32_t tag = NOT_FOUND;
+ uint32_t offset = i_rpn_id - Rpn::ARRAY_INDEX;
+ string any("ANY");
+ if(iv_used_lit.size() == 0) get_tag(use_symbol(any));
+ if(offset < iv_lits.size())
+ {
+ // numeric lits are numbered after enum lits, but with different TYPE
+ tag = (iv_used_lit.size() + offset) | NUM_TYPE;
+ }
+ else
+ {
+ ostringstream err;
+ err << hex;
+ err << "ERROR! - Symbols::get_numeric_array_tag() invalid arg rpn_id = " << i_rpn_id << endl;
+ throw invalid_argument(err.str());
+ }
+ return (uint16_t)tag;
+}
+
+// ------------------------------------------------------------------------------------------------
+
uint64_t Symbols::get_numeric_data(uint32_t i_rpn_id, uint32_t & o_size)
{
uint64_t data = 0;
@@ -455,6 +527,7 @@ string Symbols::find_text(uint32_t i_cini_id)
{
for(SYMBOL_MAP::const_iterator i = iv_symbols.begin(); i != iv_symbols.end(); ++i)
{
+ //printf("SYMBOL:%s\n",i->first.c_str());
if((i->second).first == i_cini_id)
{
name = i->first;
@@ -516,8 +589,8 @@ uint32_t Symbols::use_enum(const string & enumname)
}
else
{
- rpn_id = Rpn::SPY_ENUM | iv_rpn_id++;
- iv_enums[s] = rpn_id;
+ printf("Error!\n");
+ exit(0);
}
return rpn_id;
}
@@ -568,7 +641,7 @@ string Symbols::full_listing()
}
ostringstream title;
- title << "\n--------------- Variable Symbol Table ---------------\n\n"
+ title << "\n--------------- Attribute Symbol Table ---------------\n\n"
<< "0x" << hex << setfill('0') << setw(8) << count << '\t'
<< "Number of variables\n" << oss.str();
@@ -616,7 +689,7 @@ string Symbols::listing()
oss << hex << setfill('0');
- oss << "\n--------------- Variable Symbol Table ---------------\n\n"
+ oss << "\n--------------- Attribute Symbol Table ---------------\n\n"
<< "0x" << setw(4) << iv_used_var.size()-1 << '\t' << "Number of variables\n";
for(SYMBOL_USED::iterator i = iv_used_var.begin() + 1; i != iv_used_var.end(); ++i)
@@ -624,19 +697,13 @@ string Symbols::listing()
++count;
oss << "Type:" << setw(2) << iv_attr_type[find_text(*i)] << " Value:0x" << setw(8) << (*i) << '\t' << "ID 0X" << setw(4) << (count | VAR_TYPE)
<< '\t' << '[' << find_text(*i) << ']' << endl;
+
+ //printf("ATTRIBUTE: %s Value:0x%02X\n",(find_text(*i)).c_str(),iv_attr_type[find_text(*i)]);
}
count = 0;
- oss << "\n--------------- Literal Symbol Table -----------------\n\n"
- << "0x" << setw(4) << iv_used_lit.size()-1 << '\t' << "Number of enumerated literals\n";
-
- for(SYMBOL_USED::iterator i = iv_used_lit.begin() + 1; i != iv_used_lit.end(); ++i)
- {
- ++count;
- oss << "0x" << setw(8) << (*i) << '\t' << "ID 0x" << setw(4) << (count | LIT_TYPE)
- << '\t' << '[' << find_text(*i) << ']' << endl;
- }
+ oss << "\n--------------- Literal Symbol Table -----------------\n\n";
oss << "\n0x" << setw(4) << iv_lits.size() << '\t' << "Number of numeric literals\n";
@@ -702,18 +769,8 @@ uint32_t Symbols::bin_lits(BINSEQ & blist)
string any = "ANY";
get_tag(use_symbol(any));
- uint32_t total = 0;
- uint32_t count = iv_used_lit.size() - 1; // First lit is "ANY' and is not stored
-
- Rpn::set16(blist,(uint16_t)count);
-
- for(SYMBOL_USED::iterator i = iv_used_lit.begin() + 1; i != iv_used_lit.end(); ++i)
- {
- Rpn::set32(blist,(*i));
- }
-
- total += count;
- count = iv_lits.size();
+ uint32_t count = iv_lits.size();
+ uint32_t total = count;
Rpn::set16(blist,(uint16_t)count);
@@ -757,15 +814,9 @@ uint32_t Symbols::restore_var_bseq(BINSEQ::const_iterator & bli)
uint32_t Symbols::restore_lit_bseq(BINSEQ::const_iterator & bli)
{
- uint32_t enum_count = Rpn::extract16(bli);
iv_used_lit.clear();
iv_used_lit.push_back(iv_rpn_map[Rpn::SYMBOL|INIT_ANY_LIT].second); // ANY lit always first
- for(uint32_t i = 0; i < enum_count; ++i)
- {
- iv_used_lit.push_back(Rpn::extract32(bli));
- }
-
iv_lits.clear();
uint32_t num_count = Rpn::extract16(bli);
@@ -792,7 +843,7 @@ uint32_t Symbols::restore_lit_bseq(BINSEQ::const_iterator & bli)
iv_lits.push_back( LIT_DATA(data, size) );
}
- return enum_count + num_count;
+ return num_count;
}
//-------------------------------------------------------------------------------------------------
diff --git a/src/build/ifcompiler/initSymbols.H b/src/build/ifcompiler/initSymbols.H
index 56aed98e7..68ba70718 100755
--- a/src/build/ifcompiler/initSymbols.H
+++ b/src/build/ifcompiler/initSymbols.H
@@ -17,9 +17,10 @@
// Change Log *************************************************************************************
//
-// Flag Track Userid Date Description
-// ---- -------- -------- -------- -------------------------------------------------------------
-// D754106 dgilbert 06/14/10 Create
+// Flag Track Userid Date Description
+// ---- -------- -------- -------- -------------------------------------------------------------
+// D754106 dgilbert 06/14/10 Create
+// andrewg 09/19/11 Updates based on review
// End Change Log *********************************************************************************
/**
@@ -65,9 +66,11 @@ namespace init
enum
{
SYM_ATTR_UINT8_TYPE = 0x00,
- SYM_ATTR_UINT32_TYPE,
- SYM_ATTR_UINT64_TYPE,
- SYM_ATTR_STRING_TYPE,
+ SYM_ATTR_UINT32_TYPE = 0x01,
+ SYM_ATTR_UINT64_TYPE = 0x02,
+ SYM_ATTR_UINT8_ARRAY_TYPE = 0x03,
+ SYM_ATTR_UINT32_ARRAY_TYPE = 0x04,
+ SYM_ATTR_UINT64_ARRAY_TYPE = 0x05,
};
enum
@@ -121,6 +124,14 @@ namespace init
*/
uint32_t find_numeric_lit(uint64_t i_data, int32_t byte_size);
+ /**
+ * Find the tag for the numeric array lit
+ * @param data
+ * @param number of significant bytes in the data [1-8]
+ * @returns Rpn id
+ */
+ uint32_t find_numeric_array_lit(uint64_t i_data, int32_t byte_size);
+
/**
* Convert a numeric literal Rpn tag to an initfile tag
* @param Rpn id returned by find_numeric_lit
@@ -129,6 +140,16 @@ namespace init
* in the initfile.
*/
uint16_t get_numeric_tag(uint32_t i_rpn_id);
+
+ /**
+ * Convert a numeric array literal Rpn tag to an initfile tag
+ * @param Rpn id returned by find_numeric_lit
+ * @return tag
+ * @pre Must not be called until find_numeric_array_lit() has been called for all numbers
+ * in the initfile.
+ */
+ uint16_t get_numeric_array_tag(uint32_t i_rpn_id);
+
/**
* Get the literal data value from the Rpn id returned by find_numeric_lit()
* @param uint32_t Rpn id
@@ -201,7 +222,7 @@ namespace init
string find_text(uint32_t i_cini_id);
uint32_t add_undefined(const string & s);
- uint32_t get_attr_type(const string &i_type);
+ uint32_t get_attr_type(const string &i_type, bool i_array);
private: //data
diff --git a/src/build/ifcompiler/makefile b/src/build/ifcompiler/makefile
index 8a66f6927..6fe932a24 100755
--- a/src/build/ifcompiler/makefile
+++ b/src/build/ifcompiler/makefile
@@ -19,6 +19,7 @@
# Flag Reason Userid Date Description
# ---- ------- -------- -------- -----------
# andrewg 05/24/11 Updated for VPL/PgP
+# andrewg 10/07/11 Update based on review
#
# To execute initCompiler against sample.initfile, run the following:
@@ -28,9 +29,11 @@
# process it.
#
# sample.if.list will be a listing file describing the binary content of the initfile
+#
+# add a "-d" to flex command line to get debug output.
all:
- yacc -d initCompiler.y; flex -d initCompiler.lex; g++ initCompiler.C lex.yy.c y.tab.c initRpn.C initScom.C initSymbols.C -I./ -o initCompiler
+ yacc -d initCompiler.y; flex initCompiler.lex; g++ initCompiler.C lex.yy.c y.tab.c initRpn.C initScom.C initSymbols.C -I./ -o initCompiler
clean:
- rm -f initCompiler lex.yy.c *.if *.list y.tab.*
+ rm -f initCompiler lex.yy.c *.if *.list y.tab.* *.dbg
diff --git a/src/build/ifcompiler/sample.initfile b/src/build/ifcompiler/sample.initfile
index 851d9384b..deef9ba97 100755
--- a/src/build/ifcompiler/sample.initfile
+++ b/src/build/ifcompiler/sample.initfile
@@ -24,14 +24,14 @@ SyntaxVersion = 1
#--******************************************************************************
#-- -----------------------------------------------------------------------------
-define def_equal_test = (ATTR_TEST_UINT32 == ATTR_TEST_UINT64);
-define def_not_equal_test = (ATTR_TEST_UINT32 != ATTR_TEST_UINT64);
+define def_equal_test = (ATTR_SCRATCH_UINT32_1 == ATTR_SCRATCH_UINT32_2);
+define def_not_equal_test = (ATTR_SCRATCH_UINT64_1 != ATTR_SCRATCH_UINT64_2);
#--******************************************************************************
#-- Basic SCOM
#--******************************************************************************
-scom 0x0000000000000001 [when=L] {
+scom 0x0000000000000001 {
scom_data ;
0x0000000000000181 ;
}
@@ -40,16 +40,16 @@ scom 0x0000000000000001 [when=L] {
#-- Basic SCOM with Expression and Attribute
#--******************************************************************************
-scom 0x0000000000000002 [when=C] {
+scom 0x0000000000000002 {
scom_data, expr ;
- 0x0000000000000182, ATTR_TEST_UINT8 == ATTR_TEST_UINT32 ;
+ 0x0000000000000182, ATTR_SCRATCH_UINT8_1 == ATTR_SCRATCH_UINT8_2 ;
}
#--******************************************************************************
#-- Basic SCOM with Array In Middle
#--******************************************************************************
-scom 0x000000000(ABC,BCD)0003 [when=D] {
+scom 0x000000000(ABC,BCD)0003 {
scom_data ;
0x0000000000000183 ;
}
@@ -58,16 +58,25 @@ scom 0x000000000(ABC,BCD)0003 [when=D] {
#-- Basic SCOM with define used
#--******************************************************************************
-scom 0x0000000000000004 [when=S] {
+scom 0x0000000000000004 {
scom_data, expr ;
0x0000000000000184, def_equal_test ;
}
#--******************************************************************************
+#-- Basic SCOM with a single bit set
+#--******************************************************************************
+
+scom 0x0000000000000005 {
+ bits , scom_data ;
+ 23 , 0b1 ;
+}
+
+#--******************************************************************************
#-- Basic SCOM with bits
#--******************************************************************************
-scom 0x0000000000000005 [when=S] {
+scom 0x0000000000000006 {
bits , scom_data ;
0:11 , 0b001111001001 ;
12 , 0b1 ;
@@ -79,40 +88,46 @@ scom 0x0000000000000005 [when=S] {
#-- Complext SCOM with Bit Support, define, and attributes
#--******************************************************************************
-scom 0x0000000000000006 [when=S] {
+scom 0x0000000000000007 {
bits , scom_data, expr ;
0:11 , 0b001111001001, any ;
12 , 0b1, def_equal_test ;
12 , 0b0, def_not_equal_test ;
- 13 , 0b1, ATTR_TEST_UINT32 > ATTR_TEST_UINT64 ;
- 14:59, 0b0000001100000110010000000000010000010010000000, ATTR_TEST_UINT8 == ATTR_TEST_UINT32 ;
+ 13 , 0b1, ATTR_SCRATCH_UINT8_1 > ATTR_SCRATCH_UINT8_2 ;
+ 14:59, 0b0000001100000110010000000000010000010010000000, ATTR_SCRATCH_UINT64_1 == ATTR_SCRATCH_UINT64_2 ;
}
#--******************************************************************************
-#-- Basic SCOM with Expression and Attribute (array)
+#-- Complex SCOM with Bit Support, and logical operators
#--******************************************************************************
-scom 0x0000000000000007 [when=C] {
- scom_data, expr ;
- 0x0000000000000182, ATTR_TEST_UINT8_ARRAY[2] == ATTR_TEST_UINT32 ;
+scom 0x0000000000000009 {
+ bits , scom_data, expr ;
+ 12 , 0b1, def_equal_test && def_not_equal_test ;
+ 12 , 0b0, def_equal_test || def_not_equal_test ;
+ 14 , 0b1, ATTR_SCRATCH_UINT32_1 < ATTR_SCRATCH_UINT32_2 ;
+ 15 , 0b1, ATTR_SCRATCH_UINT32_1 > ATTR_SCRATCH_UINT32_2 ;
+ 16 , 0b1, ATTR_SCRATCH_UINT32_1 >= ATTR_SCRATCH_UINT32_2 ;
+ 17 , 0b1, ATTR_SCRATCH_UINT32_1 <= ATTR_SCRATCH_UINT32_2 ;
+ 18 , 0b1, ATTR_SCRATCH_UINT32_1 == ATTR_SCRATCH_UINT32_2 ;
+ 19 , 0b1, ATTR_SCRATCH_UINT32_1 != ATTR_SCRATCH_UINT32_2 ;
+ 20 , 0b1, (ATTR_SCRATCH_UINT32_1 + ATTR_SCRATCH_UINT32_2) == 4 ;
+ 21:59, 0b000000110000011001000000000001000001001, ATTR_SCRATCH_UINT8_1 == ATTR_SCRATCH_UINT8_2 ;
}
#--******************************************************************************
-#-- Complext SCOM with Bit Support, and logical operators
+#-- SCOM with 'ec' column - Use scratch for now since all attributes work
#--******************************************************************************
-scom 0x0000000000000008 [when=S] {
- bits , scom_data, expr ;
- 12 , 0b1, def_equal_test && def_not_equal_test ;
- 12 , 0b0, def_equal_test || def_not_equal_test ;
- 14 , 0b1, ATTR_TEST_UINT32 < ATTR_TEST_UINT64 ;
- 15 , 0b1, ATTR_TEST_UINT32 > ATTR_TEST_UINT64 ;
- 16 , 0b1, ATTR_TEST_UINT32 >= ATTR_TEST_UINT64 ;
- 17 , 0b1, ATTR_TEST_UINT32 <= ATTR_TEST_UINT64 ;
- 18 , 0b1, ATTR_TEST_UINT32 == ATTR_TEST_UINT64 ;
- 19 , 0b1, ATTR_TEST_UINT32 != ATTR_TEST_UINT64 ;
- 20 , 0b1, (ATTR_TEST_UINT32 + ATTR_TEST_UINT64) == 4;
- 21:59, 0b000000110000011001000000000001000001001, ATTR_TEST_UINT8 == ATTR_TEST_UINT32 ;
+scom 0x000000000000000A {
+ scom_data, ATTR_SCRATCH_UINT32_1 ;
+ 0x0000000000000192, 1 ;
}
-
+#--******************************************************************************
+#-- Basic SCOM with an array
+#--******************************************************************************
+scom 0x000000000000000B {
+ scom_data, expr ;
+ 0x0000000000000182, ATTR_SCRATCH_UINT8_ARRAY_1[2] == ATTR_SCRATCH_UINT8_1 ;
+}
OpenPOWER on IntegriCloud