summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/usr/hwpf/hwp/initfiles/sample.define22
-rwxr-xr-xsrc/usr/hwpf/hwp/initfiles/sample.initfile29
-rwxr-xr-xsrc/usr/hwpf/ifcompiler/initCompiler.lex46
3 files changed, 94 insertions, 3 deletions
diff --git a/src/usr/hwpf/hwp/initfiles/sample.define b/src/usr/hwpf/hwp/initfiles/sample.define
new file mode 100755
index 000000000..4025ea6d4
--- /dev/null
+++ b/src/usr/hwpf/hwp/initfiles/sample.define
@@ -0,0 +1,22 @@
+#-- -----------------------------------------------------------------------------
+#-- Change Log *************************************************************************************
+#--
+#-- Flag Userid Date Description
+#-- ----- -------- -------- -------------------------------------------------------------
+#-- camvanng 02/07/12 Created sample define file
+#-- End Change Log *********************************************************************************
+#-- -----------------------------------------------------------------------------
+
+#-- @file sample.define
+#-- @brief common scom initfile defines
+
+#-- -----------------------------------------------------------------------------
+#--******************************************************************************
+#-- -----------------------------------------------------------------------------
+#--
+#-- Defines
+#-- -----------------------------------------------------------------------------
+#--******************************************************************************
+#-- -----------------------------------------------------------------------------
+define def_uint8_greater_test = (SYS.ATTR_SCRATCH_UINT8_1 > SYS.ATTR_SCRATCH_UINT8_2);
+define def_uint32_greater_test = (SYS.ATTR_SCRATCH_UINT32_1 > SYS.ATTR_SCRATCH_UINT32_2);
diff --git a/src/usr/hwpf/hwp/initfiles/sample.initfile b/src/usr/hwpf/hwp/initfiles/sample.initfile
index 36733aa50..afcef533d 100755
--- a/src/usr/hwpf/hwp/initfiles/sample.initfile
+++ b/src/usr/hwpf/hwp/initfiles/sample.initfile
@@ -18,6 +18,17 @@ SyntaxVersion = 1
#--******************************************************************************
#-- -----------------------------------------------------------------------------
#--
+#-- Includes
+#-- Note: Must include the path to the .define file.
+#-- -----------------------------------------------------------------------------
+#--******************************************************************************
+#-- -----------------------------------------------------------------------------
+include ./hwp/initfiles/sample.define
+
+#-- -----------------------------------------------------------------------------
+#--******************************************************************************
+#-- -----------------------------------------------------------------------------
+#--
#-- Defines
#--
#-- -----------------------------------------------------------------------------
@@ -47,6 +58,20 @@ scom 0x0000000013030007 {
#--******************************************************************************
#-- SCOM with Address and Data of Array Type, Range of Index, Bit Support
+#-- The following Scom is equivalent to:
+#scom 0x000000000006002B {
+# bits, scom_data , expr;
+# 0:7, SYS.ATTR_SCRATCH_UINT8_ARRAY_1[2], SYS.ATTR_SCRATCH_UINT8_ARRAY_1[2] > SYS.ATTR_SCRATCH_UINT8_1;
+# 24:31, SYS.ATTR_SCRATCH_UINT8_ARRAY_1[2], SYS.ATTR_SCRATCH_UINT8_1 == SYS.ATTR_SCRATCH_UINT8_ARRAY_1[3];
+# 32:39, SYS.ATTR_SCRATCH_UINT8_ARRAY_2[0][1][2], SYS.ATTR_SCRATCH_UINT8_ARRAY_1[0] < SYS.ATTR_SCRATCH_UINT8_ARRAY_1[1];
+#}
+#
+#scom 0x000000000006002C {
+# bits, scom_data , expr;
+# 0:7, SYS.ATTR_SCRATCH_UINT8_ARRAY_1[2], SYS.ATTR_SCRATCH_UINT8_ARRAY_1[31] > SYS.ATTR_SCRATCH_UINT8_1;
+# 24:31, SYS.ATTR_SCRATCH_UINT8_ARRAY_1[31], SYS.ATTR_SCRATCH_UINT8_1 == SYS.ATTR_SCRATCH_UINT8_ARRAY_1[7];
+# 32:39, SYS.ATTR_SCRATCH_UINT8_ARRAY_2[1][2][3], SYS.ATTR_SCRATCH_UINT8_ARRAY_1[17] < SYS.ATTR_SCRATCH_UINT8_ARRAY_1[18];
+#}
#--******************************************************************************
scom 0x000000000006002(B,C) {
@@ -104,7 +129,7 @@ scom 0x0000000013013284 {
0:11 , 0b001111001001, any ;
12 , 0b1, def_equal_test ;
12 , 0b0, def_not_equal_test ;
- 13 , 0b1, SYS.ATTR_SCRATCH_UINT8_1 > SYS.ATTR_SCRATCH_UINT8_2 ;
+ 13 , 0b1, def_uint8_greater_test ;
14:59, 0b0000001100000110010000000000010000010010000000, SYS.ATTR_SCRATCH_UINT64_2 == ENUM_ATTR_SCRATCH_UINT64_2_VAL_C;
}
@@ -117,7 +142,7 @@ scom 0x0000000013013285 {
12 , 0b1, def_equal_test && def_not_equal_test ;
12 , 0b0, def_equal_test || def_not_equal_test ;
14 , 0b1, SYS.ATTR_SCRATCH_UINT32_1 < SYS.ATTR_SCRATCH_UINT32_2 ;
- 15 , 0b1, SYS.ATTR_SCRATCH_UINT32_1 > SYS.ATTR_SCRATCH_UINT32_2 ;
+ 15 , 0b1, def_uint32_greater_test ;
16 , 0b1, SYS.ATTR_SCRATCH_UINT32_1 >= SYS.ATTR_SCRATCH_UINT32_2 ;
17 , 0b1, SYS.ATTR_SCRATCH_UINT32_1 <= SYS.ATTR_SCRATCH_UINT32_2 ;
18 , 0b1, SYS.ATTR_SCRATCH_UINT32_1 == SYS.ATTR_SCRATCH_UINT32_2 ;
diff --git a/src/usr/hwpf/ifcompiler/initCompiler.lex b/src/usr/hwpf/ifcompiler/initCompiler.lex
index e1c2116ec..174a51550 100755
--- a/src/usr/hwpf/ifcompiler/initCompiler.lex
+++ b/src/usr/hwpf/ifcompiler/initCompiler.lex
@@ -27,6 +27,7 @@
// camvanng 11/16/11 Support system & target attributes
// 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
// End Change Log *********************************************************************************/
/**
* @file initCompiler.lex
@@ -69,6 +70,10 @@ std::string g_scomname; // dg02
extern int yyline;
+#define MAX_INCLUDE_DEPTH 10
+YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
+int include_stack_num = 0;
+
%}
@@ -104,6 +109,7 @@ MULTI_DIGIT [0-9]+
%x target
%x attribute
%x array
+%x incl
%%
@@ -112,7 +118,17 @@ MULTI_DIGIT [0-9]+
\$Id:.*\n ++yyline; /* toss this - read by initCompiler.C */
/* Special end-of-file character. */
-<<EOF>> { return 0; }
+<<EOF>> {
+ if (--include_stack_num < 0)
+ {
+ return 0;
+ }
+ else
+ {
+ yy_delete_buffer(YY_CURRENT_BUFFER);
+ yy_switch_to_buffer(include_stack[include_stack_num]);
+ }
+ }
SyntaxVersion return INIT_VERSION;
@@ -130,6 +146,34 @@ Versions BEGIN(fnames);
return INIT_VERSIONS;
}
+include { BEGIN(incl); }
+<incl>[ \t]* /* Eat up whitespace */
+<incl>[^ \t\n]+ { /* Got the include file name */
+ /*printf("include file %s\n", yytext);*/
+ if ( include_stack_num >= MAX_INCLUDE_DEPTH )
+ {
+ lex_err("Includes nested too deeply");
+ exit( 1 );
+ }
+
+ /* Save current input buffer */
+ include_stack[include_stack_num++] =
+ YY_CURRENT_BUFFER;
+
+ /* Switch input buffer */
+ yyin = fopen( yytext, "r" );
+ if (NULL == yyin)
+ {
+ oss.str("");
+ oss << "Cannot open file: " << yytext;
+ lex_err(oss.str().c_str());
+ exit(1);
+ }
+ yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
+
+ BEGIN(INITIAL);
+ }
+
define { return INIT_DEFINE;}
OpenPOWER on IntegriCloud