summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/ifcompiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/hwpf/ifcompiler')
-rwxr-xr-xsrc/usr/hwpf/ifcompiler/initCompiler.lex9
-rwxr-xr-xsrc/usr/hwpf/ifcompiler/initCompiler.y8
-rwxr-xr-xsrc/usr/hwpf/ifcompiler/initScom.C81
-rwxr-xr-xsrc/usr/hwpf/ifcompiler/initScom.H6
4 files changed, 82 insertions, 22 deletions
diff --git a/src/usr/hwpf/ifcompiler/initCompiler.lex b/src/usr/hwpf/ifcompiler/initCompiler.lex
index cc811e017..be59d834d 100755
--- a/src/usr/hwpf/ifcompiler/initCompiler.lex
+++ b/src/usr/hwpf/ifcompiler/initCompiler.lex
@@ -25,6 +25,7 @@
// andrewg 09/19/11 Updates based on review
// camvanng 11/08/11 Added support for attribute enums
// camvanng 11/16/11 Support system & target attributes
+// camvanng 12/12/11 Support multiple address ranges within a SCOM address
// End Change Log *********************************************************************************/
/**
* @file initCompiler.lex
@@ -141,6 +142,12 @@ scom { BEGIN(scomop); oss.str(""); return INIT_SCOM; }
<scomop>[\(] {BEGIN(scomop_array); return yytext[0];}
+<scomop_array>{SINGLE_HEX}+\.\.{SINGLE_HEX}+ {
+ yylval.str_ptr = new std::string(yytext);
+ oss.str("");
+ return INIT_INT64_STR;
+ }
+
<scomop_array>{SINGLE_HEX}+ {
yylval.str_ptr = new std::string(yytext);
oss.str("");
@@ -156,6 +163,8 @@ scom { BEGIN(scomop); oss.str(""); return INIT_SCOM; }
return INIT_SCOM_SUFFIX;
}
+<scomop_suffix>[\(] { BEGIN(scomop_array); return yytext[0]; }
+
<scomop>[:;\[] { BEGIN(INITIAL); g_coltype = 0; return yytext[0]; }
<scomop>{NEWLINE} { BEGIN(INITIAL); ++yyline; }
diff --git a/src/usr/hwpf/ifcompiler/initCompiler.y b/src/usr/hwpf/ifcompiler/initCompiler.y
index 4c8da2ca3..1bbc43220 100755
--- a/src/usr/hwpf/ifcompiler/initCompiler.y
+++ b/src/usr/hwpf/ifcompiler/initCompiler.y
@@ -24,6 +24,7 @@
// andrewg 09/19/11 Updates based on review
// camvanng 11/08/11 Added support for attribute enums
// andrewg 11/09/11 Refactor to use common include with hwp framework.
+// camvanng 12/12/11 Support multiple address ranges within a SCOM address
// End Change Log *********************************************************************************
/**
* @file initCompiler.y
@@ -163,12 +164,13 @@ scom: INIT_SCOM {current_scom = new init::Scom(yyscomlist->get_symbols(),y
scomaddr:
| INIT_SCOM_ADDR {
- /*printf("Found an INIT_SCOM_ADDR 0x%X!\n",$1);*/
+ /* printf("Found an INIT_SCOM_ADDR 0x%X %s\n",$1, (*($1)).c_str()); */
current_scom->set_scom_address(*($1)); delete $1;
yyscomlist->insert(current_scom);
}
- | scomaddr '(' scom_list ')' { }
- | scomaddr '(' scom_list ')' INIT_SCOM_SUFFIX { current_scom->set_scom_suffix(*($5)); delete $5; }
+ | scomaddr '(' scom_list ')' { current_scom->copy_dup_scom_address(); }
+ | scomaddr '(' scom_list ')' INIT_SCOM_SUFFIX { current_scom->copy_dup_scom_address();
+ current_scom->set_scom_suffix(*($5)); delete $5; }
;
diff --git a/src/usr/hwpf/ifcompiler/initScom.C b/src/usr/hwpf/ifcompiler/initScom.C
index b37c05182..ce5483d37 100755
--- a/src/usr/hwpf/ifcompiler/initScom.C
+++ b/src/usr/hwpf/ifcompiler/initScom.C
@@ -25,6 +25,8 @@
// andrewg 09/19/11 Updates based on review
// andrewg 11/09/11 Multi-dimensional array and move to common fapi include
// mjjones 11/17/11 Output attribute listing
+// camvanng 12/12/11 Support multiple address ranges within a SCOM address
+// Use strtoull vs strtoul for 32-bit platforms
// End Change Log *********************************************************************************
/**
@@ -443,8 +445,6 @@ uint32_t Scom::bin_listing(BINSEQ & blist)
ranges.insert(iv_range_list.begin(),iv_range_list.end());
SCOM_ADDR::iterator i = iv_scom_addr.begin();
- // if more than one spyname, the first is just the stem of the name - skip it
- if(iv_scom_addr.size() > 1) ++i;
for(; i != iv_scom_addr.end(); ++i)
{
@@ -460,16 +460,16 @@ uint32_t Scom::bin_listing(BINSEQ & blist)
// - Recreate the spy from the bytecode
// - Compile the recreated spy back into bytecode.
BINSEQ temp;
- bin_list_one(temp,strtoul((*i).c_str(),NULL,16), *r);
+ bin_list_one(temp,strtoull((*i).c_str(),NULL,16), *r);
BINSEQ::const_iterator bi = temp.begin();
Scom s(bi,iv_symbols);
- s.bin_list_one(blist,strtoul((*i).c_str(),NULL,16), RANGE(1,0));
+ s.bin_list_one(blist,strtoull((*i).c_str(),NULL,16), RANGE(1,0));
}
}
else
{
++scom_count;
- bin_list_one(blist,strtoul((*i).c_str(),NULL,16), RANGE(1,0));
+ bin_list_one(blist,strtoull((*i).c_str(),NULL,16), RANGE(1,0));
}
}
@@ -1339,15 +1339,61 @@ void Scom::set_scom_address(const string & i_scom_addr)
void Scom::dup_scom_address(const string & i_scom_addr)
{
+ if (iv_scom_addr.size() == 0)
+ {
+ yyerror("No base scom address to dulicate for append!");
+ }
- if(iv_scom_addr.size())
+ // cout << "I>Scom::dup_scom_address: "<< i_scom_addr << " is the output string!" << endl;
+
+ size_t l_pos = i_scom_addr.find("..");
+ if (l_pos != string::npos)
{
- iv_scom_addr.push_back(iv_scom_addr.front() + i_scom_addr);
+ uint64_t l_num1 = strtoull((i_scom_addr.substr(0,l_pos)).c_str(), NULL, 16);
+ uint64_t l_num2 = strtoull((i_scom_addr.substr(l_pos + 2)).c_str(), NULL, 16);
+ // cout << "I>Scom:dup_scom_address: " << l_num1 << " - " << l_num2 << endl;
+ if (l_num1 >= l_num2)
+ {
+ std::ostringstream oss;
+ oss << "Invalid scom address range: " << i_scom_addr;
+ yyerror(oss.str().c_str());
+ }
+
+ for (uint64_t num = l_num1; num <= l_num2; num++)
+ {
+ for (size_t i = 0; i < iv_scom_addr.size(); i++)
+ {
+ stringstream l_ss;
+ l_ss << hex << num;
+ iv_dup_scom_addr.push_back(iv_scom_addr.at(i) + l_ss.str());
+ // cout << "I>Scom::dup_scom_address: iv_dup_scom_addr " << iv_dup_scom_addr.back() << endl;
+ }
+ }
}
else
- yyerror("No base scom address to dulicate for append!");
+ {
+ for (size_t i = 0; i < iv_scom_addr.size(); i++)
+ {
+ iv_dup_scom_addr.push_back(iv_scom_addr.at(i) + i_scom_addr);
+ // cout << "I>Scom::dup_scom_address: iv_dup_scom_addr " << iv_dup_scom_addr.back() << endl;
+ }
+ }
- // cout << "I>Scom::dup_scom_address: "<< i_scom_addr << " is the output string!" << endl;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+void Scom::copy_dup_scom_address()
+{
+ // cout << "I>Scom::copy_dup_scom_address: iv_scom_addr size "<< iv_scom_addr.size()
+ // << " iv_dup_scom_addr size " << iv_dup_scom_addr.size() << endl;
+
+ iv_scom_addr.clear();
+ iv_scom_addr = iv_dup_scom_addr;
+ iv_dup_scom_addr.clear();
+
+ // cout << "I>Scom::copy_dup_scom_address: iv_scom_addr size "<< iv_scom_addr.size()
+ // << " iv_dup_scom_addr size " << iv_dup_scom_addr.size() << endl;
}
//-------------------------------------------------------------------------------------------------
@@ -1355,18 +1401,17 @@ void Scom::dup_scom_address(const string & i_scom_addr)
void Scom::set_scom_suffix(const string & i_scom_addr)
{
- if(iv_scom_addr.size() == 1) iv_scom_addr[0] = iv_scom_addr[0] + i_scom_addr;
- else if(iv_scom_addr.size() > 1)
+ if(iv_scom_addr.size() == 0)
{
- SCOM_ADDR::iterator i = iv_scom_addr.begin();
- ++i;
- for(;i != iv_scom_addr.end(); ++i)
+ yyerror("No base scom address to append suffix");
+ }
+ else
+ {
+ for(size_t i = 0; i < iv_scom_addr.size(); ++i)
{
- *i += i_scom_addr;
+ iv_scom_addr.at(i) = iv_scom_addr.at(i) + i_scom_addr;
}
}
- else
- yyerror("No base scom address to append suffix");
- // cout << "I>Scom::set_scom_suffix: "<< i_scom_addr << " is the output string!" << endl;
+ // cout << "I>Scom::set_scom_suffix: "<< i_scom_addr << " is the output string!" << endl;
}
diff --git a/src/usr/hwpf/ifcompiler/initScom.H b/src/usr/hwpf/ifcompiler/initScom.H
index 35938ba20..83b1727be 100755
--- a/src/usr/hwpf/ifcompiler/initScom.H
+++ b/src/usr/hwpf/ifcompiler/initScom.H
@@ -25,6 +25,8 @@
// andrewg 05/24/11 Port over for VPL/PgP
// andrewg 09/19/11 Updates based on review
// mjjones 11/17/11 Output attribute listing
+// camvanng 12/12/11 Support multiple address ranges within a SCOM address
+// Use strtoull vs strtoul for 32-bit platforms
// End Change Log *********************************************************************************
/**
@@ -137,7 +139,7 @@ namespace init
void make_target(const char * i_symbol);
- uint64_t get_address(void) {return(strtoul(iv_scom_addr[0].c_str(),NULL,16));}
+ uint64_t get_address(void) {return(strtoull(iv_scom_addr[0].c_str(),NULL,16));}
// string name();
string listing();
@@ -151,6 +153,7 @@ namespace init
void set_scom_address(const string & i_scom_addr);
void dup_scom_address(const string & i_scom_addr);
+ void copy_dup_scom_address();
void set_scom_suffix(const string & i_scom_addr);
private: // functions
@@ -169,6 +172,7 @@ namespace init
typedef map<string,SCOM_WHEN> WHEN_SUBTYPE_MAP;
SCOM_ADDR iv_scom_addr;
+ SCOM_ADDR iv_dup_scom_addr; ///< contains the duplicate scom addresses
uint64_t iv_scom_addr_hex;
uint32_t iv_scom_length;
uint32_t iv_scom_offset;
OpenPOWER on IntegriCloud