summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/usr/hwpf/hwp/initfiles/sample.initfile11
-rwxr-xr-xsrc/usr/hwpf/ifcompiler/initCompiler.lex123
-rwxr-xr-xsrc/usr/hwpf/ifcompiler/initCompiler.y45
-rwxr-xr-xsrc/usr/hwpf/ifcompiler/initScom.C243
-rwxr-xr-xsrc/usr/hwpf/ifcompiler/initScom.H45
5 files changed, 408 insertions, 59 deletions
diff --git a/src/usr/hwpf/hwp/initfiles/sample.initfile b/src/usr/hwpf/hwp/initfiles/sample.initfile
index afcef533d..f8cd0be75 100755
--- a/src/usr/hwpf/hwp/initfiles/sample.initfile
+++ b/src/usr/hwpf/hwp/initfiles/sample.initfile
@@ -190,8 +190,17 @@ scom 0x0000000013013289 {
#-- Note: These are not valid SCOM addresses. Just included here as an example of
#-- the supported syntax. Uncomment only for debugging code.
#--******************************************************************************
-#scom 0x0000006(1E..20,3c)4(A,1)(D..F)56(7,8,9,0)1 {
+#scom 0x0000006(0E..10,3c)4(A,1)(D..F)56(7,8,9,0)1 {
# scom_data ;
# 0x0000000000000193 ;
#}
+#--******************************************************************************
+#-- Basic SCOM with Bin and Hex Scom Addresses of Multiple Arrays/Address Ranges
+#-- Note: These are not valid SCOM addresses. Just included here as an example of
+#-- the supported syntax. Uncomment only for debugging code.
+#--******************************************************************************
+#scom 0x(7,8)000001301.0b1(01..10,00)(00,01)0(1,0)1.0xD(8A,8B)C {
+# scom_data ;
+# 0x0000000000000194 ;
+#}
diff --git a/src/usr/hwpf/ifcompiler/initCompiler.lex b/src/usr/hwpf/ifcompiler/initCompiler.lex
index 174a51550..39fec30bb 100755
--- a/src/usr/hwpf/ifcompiler/initCompiler.lex
+++ b/src/usr/hwpf/ifcompiler/initCompiler.lex
@@ -28,6 +28,8 @@
// camvanng 12/12/11 Support multiple address ranges within a SCOM address
// camvanng 01/20/12 Support for using a range of indexes for array attributes
// camvanng 02/07/12 Ability to #include common scom initfile defines
+// camvanng 02/14/12 Support binary and hex scom addresses
+// Support for array at beginning of scom address
// End Change Log *********************************************************************************/
/**
* @file initCompiler.lex
@@ -89,6 +91,7 @@ COMMENT #.*\n
OP "="|"+"|"-"|"|"|"<"|">"|"*"|"/"|"%"
FLOAT [0-9]+"."[0-9]*
BINARY 0[bB][0-1]+
+SINGLE_BIN [0-1]
SCOM_DATA [ ]*[scom_data][ ]+
HEX 0[xX][A-Fa-f0-9]+
SINGLE_HEX [A-Fa-f0-9]
@@ -96,8 +99,12 @@ ATTRIBUTE [\[[A-Fa-f0-9]\]]
MULTI_DIGIT [0-9]+
%x scomop
-%x scomop_array
-%x scomop_suffix
+%x scomop_hex
+%x scomop_hex_array
+%x scomop_hex_suffix
+%x scomop_bin
+%x scomop_bin_array
+%x scomop_bin_suffix
%x scomdata
%x when_kw
%x when_expr
@@ -179,41 +186,91 @@ define { return INIT_DEFINE;}
scom { BEGIN(scomop); oss.str(""); return INIT_SCOM; }
-<scomop>{HEX} {
- yylval.str_ptr = new std::string(yytext);
- oss.str("");
- return INIT_SCOM_ADDR;
- }
-
-<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("");
- return INIT_INT64_STR;
- }
-
-<scomop_array>[\)] {BEGIN(scomop_suffix); return(yytext[0]);}
-
-<scomop_suffix>{SINGLE_HEX}+ {
- yylval.str_ptr = new std::string(yytext);
- oss.str("");
- BEGIN(scomop);
- return INIT_SCOM_SUFFIX;
- }
-
-<scomop_suffix>[\(] { BEGIN(scomop_array); return yytext[0]; }
+<scomop>{HEX} { /*printf("lex: hex string %s\n", yytext);*/
+ yylval.str_ptr = new std::string(yytext);
+ BEGIN(scomop_hex);
+ return INIT_SCOM_ADDR;
+ }
+
+<scomop>0[xX] { BEGIN(scomop_hex); }
+<scomop>0[bB] { BEGIN(scomop_bin); }
+
+<scomop_hex,scomop_hex_suffix>[\(] {
+ /*printf("lex: hex string %s\n", yytext);*/
+ BEGIN(scomop_hex_array);
+ }
+
+<scomop_hex_array>{SINGLE_HEX}+\.\.{SINGLE_HEX}+ {
+ /*printf("lex: hex string %s\n", yytext);*/
+ yylval.str_ptr = new std::string(yytext);
+ return INIT_INT64_STR;
+ }
+
+<scomop_hex_array>{SINGLE_HEX}+ {
+ /*printf("lex: hex string %s\n", yytext);*/
+ yylval.str_ptr = new std::string(yytext);
+ return INIT_INT64_STR;
+ }
+
+<scomop_hex_array>[\)] {
+ /*printf("lex: hex string %s\n", yytext);*/
+ BEGIN(scomop_hex_suffix);
+ }
+
+<scomop_hex,scomop_hex_suffix>{SINGLE_HEX}+ {
+ /*printf("lex: hex string %s\n", yytext);*/
+ yylval.str_ptr = new std::string(yytext);
+ return INIT_SCOM_SUFFIX;
+ }
+
+<scomop_hex,scomop_hex_suffix>\.0[bB] { BEGIN(scomop_bin); }
+
+<scomop_bin>{SINGLE_BIN}+ {
+ /*printf("lex: bin string %s\n", yytext);*/
+ yylval.str_ptr = new std::string(yytext);
+ return INIT_SCOM_ADDR_BIN;
+ }
+
+<scomop_bin,scomop_bin_suffix>[\(] {
+ /*printf("lex: bin string %s\n", yytext);*/
+ BEGIN(scomop_bin_array);
+ }
+<scomop_bin_array>{SINGLE_BIN}+\.\.{SINGLE_BIN}+ {
+ /*printf("lex: bin string %s\n", yytext);*/
+ yylval.str_ptr = new std::string(yytext);
+ return INIT_BINARY_STR;
+ }
+
+<scomop_bin_array>{SINGLE_BIN}+ {
+ /*printf("lex: bin string %s\n", yytext);*/
+ yylval.str_ptr = new std::string(yytext);
+ return INIT_BINARY_STR;
+ }
+
+<scomop_bin_array>[\)] {
+ /*printf("lex: bin string %s\n", yytext);*/
+ BEGIN(scomop_bin_suffix);
+ }
+
+<scomop_bin_suffix>{SINGLE_BIN}+ {
+ /*printf("lex: bin string %s\n", yytext);*/
+ yylval.str_ptr = new std::string(yytext);
+ return INIT_SCOM_SUFFIX_BIN;
+ }
+
+<scomop_bin,scomop_bin_suffix>\.(0[xX])? {
+ /*printf("lex: bin string %s\n", yytext);*/
+ BEGIN(scomop_hex);
+ }
+
+<scomop_bin,scomop_bin_suffix>\.0[bB] {
+ /*printf("lex: bin string %s\n", yytext);*/
+ }
<scomop>[:;\[] { BEGIN(INITIAL); g_coltype = 0; return yytext[0]; }
<scomop>{NEWLINE} { BEGIN(INITIAL); ++yyline; }
-<scomop,scomop_suffix>[\{] {
+<scomop_hex,scomop_hex_suffix,scomop_bin,scomop_bin_suffix>[\{] {
oss.str("");
BEGIN(scomcolname);
return yytext[0];
diff --git a/src/usr/hwpf/ifcompiler/initCompiler.y b/src/usr/hwpf/ifcompiler/initCompiler.y
index 168ec5628..5c0f2d1bc 100755
--- a/src/usr/hwpf/ifcompiler/initCompiler.y
+++ b/src/usr/hwpf/ifcompiler/initCompiler.y
@@ -26,6 +26,8 @@
// andrewg 11/09/11 Refactor to use common include with hwp framework.
// camvanng 12/12/11 Support multiple address ranges within a SCOM address
// camvanng 01/20/12 Support for using a range indexes for array attributes
+// camvanng 02/14/12 Support binary and hex scom addresses
+// Support for array at beginning of scom address
// End Change Log *********************************************************************************
/**
* @file initCompiler.y
@@ -76,6 +78,9 @@ int scom;
%token <str_ptr> INIT_INT64_STR
%token <str_ptr> INIT_SCOM_ADDR
%token <str_ptr> INIT_SCOM_SUFFIX
+%token <str_ptr> INIT_BINARY_STR
+%token <str_ptr> INIT_SCOM_ADDR_BIN
+%token <str_ptr> INIT_SCOM_SUFFIX_BIN
%token <uint64> INIT_SCOM_DATA
%token <str_ptr> INIT_ID
%token <str_ptr> INIT_VERSIONS
@@ -160,18 +165,26 @@ scom: INIT_SCOM {current_scom = new init::Scom(yyscomlist->get_symbols(),y
{
/* printf("Found an INIT_SCOM!\n"); */
/* current_scom = new init::Scom(yyscomlist->get_symbols(),yyline); */
+ yyscomlist->insert(current_scom);
}
;
scomaddr:
- | INIT_SCOM_ADDR {
- /* 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 ')' { 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; }
+ scomaddr_hex { /*printf("Found a hex scom address\n");*/ }
+ | scomaddr_bin { /*printf("Found a binary scom address\n");*/
+ current_scom->append_scom_address_bin(); }
+ | scomaddr scomaddr_hex { /*printf("Found a hex scom address 2\n");*/ }
+ | scomaddr scomaddr_bin { /*printf("Append binary scom address 2\n");*/
+ current_scom->append_scom_address_bin(); }
+;
+
+
+
+scomaddr_hex:
+ | INIT_SCOM_ADDR { /*printf("Found an INIT_SCOM_ADDR %s\n", (*($1)).c_str());*/
+ current_scom->set_scom_address(*($1)); delete $1; }
+ | scom_list { current_scom->copy_dup_scom_address(); }
+ | INIT_SCOM_SUFFIX { current_scom->set_scom_suffix(*($1)); delete $1; }
;
@@ -180,6 +193,22 @@ scom_list: INIT_INT64_STR { current_scom->dup_scom_address(
;
+scomaddr_bin: INIT_SCOM_ADDR_BIN { /*printf("Found an INIT_SCOM_ADDR_BIN %s\n", (*($1)).c_str());*/
+ current_scom->set_scom_address_bin(*($1)); delete $1; }
+ | scom_bin_list { /*printf("Found a scom_bin_list\n");*/
+ current_scom->copy_dup_scom_address_bin(); }
+ | scomaddr_bin INIT_SCOM_ADDR_BIN { /*printf("Found an INIT_SCOM_ADDR_BIN 2 %s\n", (*($2)).c_str());*/
+ current_scom->set_scom_suffix_bin(*($2)); delete $2;}
+ | scomaddr_bin scom_bin_list { /*printf("Found a scom_bin_list 2\n");*/
+ current_scom->copy_dup_scom_address_bin(); }
+ | scomaddr_bin INIT_SCOM_SUFFIX_BIN { /*printf("Found a scom binary suffix %s\n", (*($2)).c_str());*/
+ current_scom->set_scom_suffix_bin(*($2)); delete $2;}
+;
+
+scom_bin_list: INIT_BINARY_STR { current_scom->dup_scom_address_bin(*($1));delete $1; }
+ | scom_bin_list ',' INIT_BINARY_STR { current_scom->dup_scom_address_bin(*($3));delete $3; }
+;
+
/* The scombody was reformatted by the scanner
* colname1 , row1 , row 2, ... , row n ;
* colname2 , row1 , row 2, ... , row n ;
diff --git a/src/usr/hwpf/ifcompiler/initScom.C b/src/usr/hwpf/ifcompiler/initScom.C
index a8cf2dd9d..bfd686832 100755
--- a/src/usr/hwpf/ifcompiler/initScom.C
+++ b/src/usr/hwpf/ifcompiler/initScom.C
@@ -29,6 +29,9 @@
// Use strtoull vs strtoul for 32-bit platforms
// camvanng 12/15/11 Support for multiple duplicate addresses setting different bits
// camvanng 01/20/12 Support for using a range of indexes for array attributes
+// camvanng 02/14/12 Support binary and hex scom addresses
+// Support for array at beginning of scom address
+// Fix bug in string size when converting decimal to hex string
// End Change Log *********************************************************************************
/**
@@ -1407,17 +1410,13 @@ 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 duplicate!");
- }
-
// cout << "I>Scom::dup_scom_address: "<< i_scom_addr << " is the output string!" << endl;
+ //If we have a range of values
size_t l_pos = i_scom_addr.find("..");
if (l_pos != string::npos)
{
+ // Convert the range specified to decimal values and check for valid range
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;
@@ -1430,38 +1429,63 @@ void Scom::dup_scom_address(const string & i_scom_addr)
for (uint64_t num = l_num1; num <= l_num2; num++)
{
- for (size_t i = 0; i < iv_scom_addr.size(); i++)
+ // For each value within the range, create a hex string of the correct size
+ string l_scom_addr = dec2hexString(num, l_pos);
+
+ if (iv_scom_addr.size() == 0)
{
- 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;
+ // If there are no base address, create the duplicate addresses by pushing back
+ // each value within the range
+ iv_dup_scom_addr.push_back(l_scom_addr);
+ // cout << "I>Scom::dup_scom_address: iv_dup_scom_addr" << iv_dup_scom_addr.back() << endl;
+ }
+ else
+ {
+ // If there are base addresses, create the dupicate addresses by appending each
+ // value within the range to the base addresses.
+ for (size_t i = 0; i < iv_scom_addr.size(); i++)
+ {
+ iv_dup_scom_addr.push_back(iv_scom_addr.at(i) + l_scom_addr);
+ // cout << "I>Scom::dup_scom_address: iv_dup_scom_addr " << iv_dup_scom_addr.back() << endl;
+ }
}
}
}
+ // Else we have a single value
else
{
- for (size_t i = 0; i < iv_scom_addr.size(); i++)
+ // If there are no base address, create the duplicate address by pushing back the specified
+ // value
+ if (iv_scom_addr.size() == 0)
{
- iv_dup_scom_addr.push_back(iv_scom_addr.at(i) + i_scom_addr);
+ iv_dup_scom_addr.push_back(i_scom_addr);
// cout << "I>Scom::dup_scom_address: iv_dup_scom_addr " << iv_dup_scom_addr.back() << endl;
}
+ else
+ {
+ // If there are base addresses, create the dupicate addresses by appending the
+ // specified value to the base addresses.
+ 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;
+ }
+ }
}
-
}
//-------------------------------------------------------------------------------------------------
void Scom::copy_dup_scom_address()
{
- // cout << "I>Scom::copy_dup_scom_address: iv_scom_addr size "<< iv_scom_addr.size()
+ // 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()
+ // 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;
}
@@ -1472,15 +1496,200 @@ void Scom::set_scom_suffix(const string & i_scom_addr)
if(iv_scom_addr.size() == 0)
{
- yyerror("No base scom address to append suffix");
+ std::ostringstream oss;
+ oss << "No base scom address to append suffix " << i_scom_addr;
+ yyerror(oss.str().c_str());
}
else
{
+ // cout << "I>Scom::set_scom_suffix: iv_scom_addr size " << iv_scom_addr.size() << endl;
for(size_t i = 0; i < iv_scom_addr.size(); ++i)
{
+ // cout << "I>Scom::set_scom_suffix: iv_scom_addr " << iv_scom_addr.at(i) << endl;
iv_scom_addr.at(i) = iv_scom_addr.at(i) + i_scom_addr;
+ // cout << "I>Scom::set_scom_suffix: iv_scom_addr appended " << iv_scom_addr.at(i) << endl;
}
}
// cout << "I>Scom::set_scom_suffix: "<< i_scom_addr << " is the output string!" << endl;
}
+
+//-------------------------------------------------------------------------------------------------
+
+void Scom::set_scom_address_bin(const string & i_scom_addr)
+{
+
+ if(iv_scom_addr_bin.size())
+ {
+ yyerror("Binary SCOM Address already set!");
+ }
+ else
+ {
+ iv_scom_addr_bin.push_back(i_scom_addr);
+ }
+
+ // cout << "I>Scom::set_scom_address_bin: " << i_scom_addr << " is the output string!" << endl;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+void Scom::dup_scom_address_bin(const string & i_scom_addr)
+{
+ // cout << "I>Scom::dup_scom_address_bin: "<< i_scom_addr << " is the output string!" << endl;
+
+ //If we have a range of values
+ size_t l_pos = i_scom_addr.find("..");
+ if (l_pos != string::npos)
+ {
+ // Convert the range specified to decimal values and check for valid range
+ uint64_t l_num1 = strtoull((i_scom_addr.substr(0,l_pos)).c_str(), NULL, 2);
+ uint64_t l_num2 = strtoull((i_scom_addr.substr(l_pos + 2)).c_str(), NULL, 2);
+ // cout << "I>Scom:dup_scom_address_bin: " << l_num1 << " - " << l_num2 << endl;
+ if (l_num1 >= l_num2)
+ {
+ std::ostringstream oss;
+ oss << "Invalid binary scom address range: " << i_scom_addr;
+ yyerror(oss.str().c_str());
+ }
+
+ for (uint64_t num = l_num1; num <= l_num2; num++)
+ {
+ // For each value within the range, create a binary string of the correct size
+ string l_scom_addr = dec2binString(num, l_pos);
+
+ if (iv_scom_addr_bin.size() == 0)
+ {
+ // If there are no base address, create the duplicate addresses by pushing back
+ // each value within the range
+ iv_dup_scom_addr_bin.push_back(l_scom_addr);
+ // cout << "I>Scom::dup_scom_address_bin: iv_dup_scom_addr_bin " << iv_dup_scom_addr_bin.back() << endl;
+ }
+ else
+ {
+ // If there are base addresses, create the dupicate addresses by appending each
+ // value within the range to the base addresses.
+ for (size_t i = 0; i < iv_scom_addr_bin.size(); i++)
+ {
+ iv_dup_scom_addr_bin.push_back(iv_scom_addr_bin.at(i) + l_scom_addr);
+ // cout << "I>Scom::dup_scom_address_bin: iv_dup_scom_addr_bin " << iv_dup_scom_addr_bin.back() << endl;
+ }
+ }
+ }
+ }
+ // Else we have a single value
+ else
+ {
+ // If there are no base address, create the duplicate address by pushing back the specified
+ // value
+ if (iv_scom_addr_bin.size() == 0)
+ {
+ iv_dup_scom_addr_bin.push_back(i_scom_addr);
+ // cout << "I>Scom::dup_scom_address_bin: iv_dup_scom_addr_bin " << iv_dup_scom_addr_bin.back() << endl;
+ }
+ else
+ {
+ // If there are base addresses, create the dupicate addresses by appending the
+ // specified value to the base addresses.
+ for (size_t i = 0; i < iv_scom_addr_bin.size(); i++)
+ {
+ iv_dup_scom_addr_bin.push_back(iv_scom_addr_bin.at(i) + i_scom_addr);
+ // cout << "I>Scom::dup_scom_address_bin: iv_dup_scom_addr_bin " << iv_dup_scom_addr_bin.back() << endl;
+ }
+ }
+ }
+}
+
+//-------------------------------------------------------------------------------------------------
+
+void Scom::copy_dup_scom_address_bin()
+{
+ // cout << "I>Scom::copy_dup_scom_address_bin: iv_scom_addr_bin size "<< iv_scom_addr_bin.size()
+ // << " iv_dup_scom_addr_bin size " << iv_dup_scom_addr_bin.size() << endl;
+
+ iv_scom_addr_bin.clear();
+ iv_scom_addr_bin = iv_dup_scom_addr_bin;
+ iv_dup_scom_addr_bin.clear();
+
+ // cout << "I>Scom::copy_dup_scom_address_bin: iv_scom_addr_bin size "<< iv_scom_addr_bin.size()
+ // << " iv_dup_scom_addr_bin size " << iv_dup_scom_addr_bin.size() << endl;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+void Scom::set_scom_suffix_bin(const string & i_scom_addr)
+{
+
+ if(iv_scom_addr_bin.size() == 0)
+ {
+ std::ostringstream oss;
+ oss << "No base binary scom address to append suffix " << i_scom_addr;
+ yyerror(oss.str().c_str());
+ }
+ else
+ {
+ for(size_t i = 0; i < iv_scom_addr_bin.size(); ++i)
+ {
+ iv_scom_addr_bin.at(i) = iv_scom_addr_bin.at(i) + i_scom_addr;
+ }
+ }
+
+ // cout << "I>Scom::set_scom_suffix_bin: "<< i_scom_addr << " is the output string!" << endl;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+void Scom::append_scom_address_bin()
+{
+ for (size_t i = 0; i < iv_scom_addr_bin.size(); i++)
+ {
+ if (0 != (iv_scom_addr_bin.at(i).size() % 4))
+ {
+ std::ostringstream oss;
+ oss << "Binary scom address " << iv_scom_addr_bin.at(i) << " is a partial hex!";
+ yyerror(oss.str().c_str());
+ break;
+ }
+ else
+ {
+ // Duplicate the scom addresses
+ uint64_t l_num = strtoull(iv_scom_addr_bin.at(i).c_str(), NULL, 2);
+ string l_scom_addr = dec2hexString(l_num, iv_scom_addr_bin.at(i).size() / 4);
+ dup_scom_address(l_scom_addr);
+ }
+ }
+
+ if (iv_dup_scom_addr.size())
+ {
+ // Copy duplicate scom addresses to the base scom addresses
+ copy_dup_scom_address();
+ iv_scom_addr_bin.clear();
+ }
+}
+
+//-------------------------------------------------------------------------------------------------
+string Scom::dec2hexString(uint64_t i_num, size_t i_str_size)
+{
+ stringstream l_ss;
+ l_ss.width(i_str_size); // Set string width
+ l_ss.fill('0'); // Prefill with '0'
+ l_ss << hex << i_num;
+
+ return l_ss.str();
+}
+
+//-------------------------------------------------------------------------------------------------
+string Scom::dec2binString(uint64_t i_num, size_t i_str_size)
+{
+ size_t l_size = sizeof(i_num) * 8;
+ char l_buf[l_size];
+ size_t l_idx = l_size;
+
+ do
+ {
+ l_buf[--l_idx] = '0' + (i_num & 1);
+ i_num >>= 1;
+ } while (--i_str_size);
+
+ return string(l_buf + l_idx, l_buf + l_size);
+}
+
diff --git a/src/usr/hwpf/ifcompiler/initScom.H b/src/usr/hwpf/ifcompiler/initScom.H
index efdd0d235..d3806ca16 100755
--- a/src/usr/hwpf/ifcompiler/initScom.H
+++ b/src/usr/hwpf/ifcompiler/initScom.H
@@ -29,6 +29,7 @@
// Use strtoull vs strtoul for 32-bit platforms
// camvanng 12/15/11 Support for multiple duplicate addresses setting different bits
// camvanng 01/20/12 Support for using a range of indexes for array attributes
+// camvanng 02/14/12 Support binary and hex scom addresses
// End Change Log *********************************************************************************
/**
@@ -177,6 +178,48 @@ namespace init
void copy_dup_scom_address();
void set_scom_suffix(const string & i_scom_addr);
+ /**
+ * @brief Set the binary SCOM address
+ * @param i_scom_addr binary address string
+ */
+ void set_scom_address_bin(const string & i_scom_addr);
+
+ /**
+ * @brief Create duplicate binary SCOM addresses and append input address string
+ * @param i_scom_addr binary address string
+ */
+ void dup_scom_address_bin(const string & i_scom_addr);
+
+ /**
+ * @brief Copy duplicate binary SCOM addresses to main binary address vector
+ */
+ void copy_dup_scom_address_bin();
+
+ /**
+ * @brief Append the input binary address string to the binary address
+ * @param i_scom_addr binary address string
+ */
+ void set_scom_suffix_bin(const string & i_scom_addr);
+
+ /**
+ * @brief Append the binary address to the hex address
+ */
+ void append_scom_address_bin();
+
+ /**
+ * @brief Convert decimal to hex string
+ * @param i_num decimal number
+ * @param i_str_size string size
+ */
+ string dec2hexString(uint64_t i_num, size_t i_str_size);
+
+ /**
+ * @brief Convert decimal to bin string
+ * @param i_num decimal number
+ * @param i_str_size string size
+ */
+ string dec2binString(uint64_t i_num, size_t i_str_size);
+
private: // functions
string list_one(RANGE range);
@@ -195,6 +238,8 @@ namespace init
SCOM_ADDR iv_scom_addr;
SCOM_ADDR iv_dup_scom_addr; ///< contains the duplicate scom addresses
uint64_t iv_scom_addr_hex;
+ SCOM_ADDR iv_scom_addr_bin; ///< temp storage for binary scom addresses
+ SCOM_ADDR iv_dup_scom_addr_bin; ///< contains the duplicate binary scom addresses
uint32_t iv_scom_length;
uint32_t iv_scom_offset;
RPN_LIST iv_scom_rpn; ///< spyv - for each row
OpenPOWER on IntegriCloud