From 2ca475148bef81d13f6d4bdfda376691c3a0f9d1 Mon Sep 17 00:00:00 2001 From: CamVan Nguyen Date: Tue, 19 Jun 2012 00:51:48 -0500 Subject: SCOM Initfile: Ability to do bitwise OR and AND operations Change-Id: Ie3836bc2e3ca580761c71ea810cd9c6c55da54b6 RTC: 43757 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1220 Tested-by: Jenkins Server Reviewed-by: Douglas R. Gilbert Reviewed-by: Andrew J. Geissler Reviewed-by: A. Patrick Williams III --- src/usr/hwpf/ifcompiler/initCompiler.lex | 3 ++- src/usr/hwpf/ifcompiler/initCompiler.y | 5 +++++ src/usr/hwpf/ifcompiler/initRpn.C | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/usr/hwpf/ifcompiler') diff --git a/src/usr/hwpf/ifcompiler/initCompiler.lex b/src/usr/hwpf/ifcompiler/initCompiler.lex index 26574b632..a9b7e5bb3 100755 --- a/src/usr/hwpf/ifcompiler/initCompiler.lex +++ b/src/usr/hwpf/ifcompiler/initCompiler.lex @@ -44,6 +44,7 @@ // Save and restore line numbers for each include file // camvanng 05/22/12 Fix "OP" definition // camvanng 06/11/12 Fix shift/reduce warnings from yacc +// camvanng 06/15/12 Ability to do bitwise OR and AND operations // End Change Log *********************************************************************************/ /** * @file initCompiler.lex @@ -113,7 +114,7 @@ ID2 [A-Za-z][A-Za-z0-9_]*(\[[0-9]+(..[0-9]+)?(,[0-9]+(..[0-9]+)?)*\]){0,4} ID3 [0-9]+[A-Za-z_]+[0-9]* DIGIT [0-9] COMMENT #.*\n -OP "="|"+"|"-"|"!"|"<"|">"|"*"|"/"|"%" +OP "="|"+"|"-"|"!"|"<"|">"|"*"|"/"|"%"|"&"|"|" FLOAT [0-9]+"."[0-9]* BINARY 0[bB][0-1]+ SINGLE_BIN [0-1] diff --git a/src/usr/hwpf/ifcompiler/initCompiler.y b/src/usr/hwpf/ifcompiler/initCompiler.y index 62f534016..39254c2b3 100755 --- a/src/usr/hwpf/ifcompiler/initCompiler.y +++ b/src/usr/hwpf/ifcompiler/initCompiler.y @@ -41,6 +41,7 @@ // in the scom_data column // camvanng 06/11/12 Ability to do logical operations with attribute columns // Fix shift/reduce warnings from yacc +// camvanng 06/15/12 Ability to do bitwise OR and AND operations // End Change Log ********************************************************************************* /** * @file initCompiler.y @@ -263,6 +264,8 @@ scomdexpr: INIT_INTEGER { $$= new init::Rpn($1,yyscomlist->get_s | scomdexpr '*' scomdexpr { $$ = $1->push_merge($3,MULT); } | scomdexpr '/' scomdexpr { $$ = $1->push_merge($3,DIVIDE); } | scomdexpr '%' scomdexpr { $$ = $1->push_merge($3,MOD); } + | scomdexpr '&' scomdexpr { $$ = $1->push_merge($3,BITWISEAND); } + | scomdexpr '|' scomdexpr { $$ = $1->push_merge($3,BITWISEOR); } | '!' scomdexpr { $$ = $2->push_op(NOT); } | '(' scomdexpr ')' { $$ = $2; } ; @@ -330,6 +333,8 @@ expr: INIT_INTEGER { $$= new init::Rpn($1,yyscomlist->get_s | expr '*' expr { $$ = $1->push_merge($3,MULT); } | expr '/' expr { $$ = $1->push_merge($3,DIVIDE); } | expr '%' expr { $$ = $1->push_merge($3,MOD); } + | expr '&' expr { $$ = $1->push_merge($3,BITWISEAND); } + | expr '|' expr { $$ = $1->push_merge($3,BITWISEOR); } | '!' expr { $$ = $2->push_op(NOT); } | '(' expr ')' { $$ = $2; } ; diff --git a/src/usr/hwpf/ifcompiler/initRpn.C b/src/usr/hwpf/ifcompiler/initRpn.C index 2443ae9d4..75558428d 100755 --- a/src/usr/hwpf/ifcompiler/initRpn.C +++ b/src/usr/hwpf/ifcompiler/initRpn.C @@ -41,6 +41,7 @@ // camvanng 05/22/12 Ability to do simple operations on attributes // in the scom_data column // SW146714 camvanng 06/08/12 Use two bytes to store row rpn sequence byte count +// camvanng 06/15/12 Ability to do bitwise OR and AND operations // End Change Log ********************************************************************************* /** @@ -84,6 +85,8 @@ const char * OP_TXT[] = "SHIFTRIGHT", "FALSE", //dg003a "TRUE", //dg003a + "BITWISEAND", + "BITWISEOR", }; std::string Rpn::cv_empty_str; -- cgit v1.2.3