⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oaverilogparser.ypp

📁 openaccess与verilog互相转化时所用的源代码
💻 YPP
📖 第 1 页 / 共 5 页
字号:
 port                           : port_expression                                   {                                    // New Module Port                                    $$ = new oaParam(*$1, *$1);                                    deletePos(1);                                 }                               | '.' port_identifier '(' ')'                                   {                                    $$ = new oaParam(*$2, 0);                                    deletePos(2);                                 }                               | '.' port_identifier                                   '(' port_expression ')'                                   {                                    // New Module Port (connected to                                     // port_expression)                                    $$ = new oaParam(*$2, *$4);                                    deletePos(2);                                    deletePos(4);                                 }                               ;  port_expression                : /* empty */                                 {                                    $$ = new oaString("");                                 }                               | port_reference                               | '{' port_reference port_reference_list '}'                                     {                                    $3->push_front($2);                                    $$ = new oaString;                                    callback->portRefListToPortExpr(*$3, *$$);                                    deletePos(3);                                 }                               // Handled at 'port'                               ;  port_reference_list            : /* empty */                                        {                                    $$ = new NameList;                                 }                               | port_reference_list ',' port_reference                                    {                                    $1->push_back($3);                                    $$ = $1;                                 }                               // Handled at 'port'                               ;  port_reference                 : port_identifier                                  {                                    // Scalar Name                                    $$ = $1;                                 }                               | port_identifier range                                  {				    *$1 += "[";				                                        if ($2->getStartInt() == $2->getStopInt()) {					if ($2->getStartVal().isString()) {					    *$1 += "0";					} else {					    *$1 += $2->getStartVal().getString();					}                                    } else {					*$1 += $2->getStartVal().getString();					*$1 += ":";					*$1 += $2->getStopVal().getString();                                    }                                    				    *$1 += "]";				    $$ = $1;                                    deletePos(2);                                 }                               ;  port_declaration               : attribute_instance_list inout_declaration                                 {                                    $$ = $2;                                    deletePos(1);                                 }                               | attribute_instance_list input_declaration                                      {                                    $$ = $2;                                    deletePos(1);                                 }                               | attribute_instance_list  output_declaration                                   {                                    $$ = $2;                                    deletePos(1);                                 }                               // Handled at 'port'                               ;      /* A.1.5 Module items */  module_item                    : attribute_instance_list                                   module_or_generate_item                                   {                                     deletePos(1);                                 }                               | port_declaration ';'                                  {                                    deletePos(1);                                 }                                | attribute_instance_list                                    generated_instantiation                                   {                                     deletePos(1);                                 }                               | attribute_instance_list                                    local_parameter_declaration                                   {                                    deletePos(1);                                    deletePos(2);                                 }                               | attribute_instance_list                                   parameter_declaration                                   {                                     deletePos(1);                                    deletePos(2);                                 }                               | attribute_instance_list specify_block                                          {                                     deletePos(1);                                 }                               | attribute_instance_list                                   specparam_declaration                                   {                                      deletePos(1);                                 }                               ;   // Handled at lower levelmodule_or_generate_item        : attribute_instance_list                                   module_or_generate_item_declaration                                   {                                      deletePos(1);                                 }                               | attribute_instance_list parameter_override                                     {                                     deletePos(1);                                  }                               | attribute_instance_list continuous_assign                                      {                                      deletePos(1);                                 }                               | attribute_instance_list gate_instantiation ';'                                 {                                     deletePos(1);                                    callback->notImplemented(GateInstImpl);                                 }                               | attribute_instance_list module_instantiation                                 {                                     deletePos(1);                                    deletePos(2);                                 }                               | attribute_instance_list udp_instantiation                                  {                                     deletePos(1);                                    deletePos(2);                                    callback->notImplemented(UDPImpl);                                 }                               | attribute_instance_list initial_construct                                      {                                      deletePos(1);                                    deletePos(2);                                 }                               | attribute_instance_list always_construct                                  {                                      deletePos(1);                                    deletePos(2);                                 }                               ;  module_or_generate_item_declaration :                                  net_declaration                               | reg_declaration                                | integer_declaration                                                          | real_declaration                                                             | time_declaration                                                             | realtime_declaration                                                         | event_declaration                                                            | genvar_declaration                                                           | task_declaration                                                             | function_declaration                                                         ;   // Not sure what to do here.  Probably handled w/parameter declarationparameter_override             : YYDEFPARAM list_of_param_assignments ';'                                      {                                    $$ = $2;                                 }                               ;  /* A.2.1 Declaration types */  local_parameter_declaration    : YYLOCALPARAM list_of_param_assignments ';'                                   {                                    callback->realDeclaration(*$2);                                    $$ = $2;                                 }                               | YYLOCALPARAM YYSIGNED                                    list_of_param_assignments ';'                                   {                                    callback->paramDeclaration(*$3);                                    $$ = $3;                                 }                               | YYLOCALPARAM range                                    list_of_param_assignments ';'                                   {                                    callback->realDeclaration(*$2,                                                              *$3);                                    deletePos(2);                                    $$ = $3;                                 }                               | YYLOCALPARAM YYSIGNED range                                    list_of_param_assignments ';'                                   {                                    callback->realDeclaration(*$3,                                                              *$4);                                    deletePos(3);                                    $$ = $4;                                 }                               | YYLOCALPARAM YYINTEGER                                    list_of_param_assignments ';'                                   {                                    callback->paramDeclaration(*$3);                                     $$ = $3;                                 }                               | YYLOCALPARAM YYREAL                                   list_of_param_assignments ';'                                   {                                    callback->realDeclaration(*$3);                                    $$ = $3;                                 }                               | YYLOCALPARAM YYREALTIME                                    list_of_param_assignments ';'                                   {                                    callback->realtimeDeclaration(*$3);                                    $$ = $3;                                 }                               | YYLOCALPARAM YYTIME                                   list_of_param_assignments ';'                                 {                                    callback->timeDeclaration(*$3);                                    $$ = $3;                                 }                               ; parameter_declaration          : YYPARAMETER list_of_param_assignments ';'                                    {                                    callback->realDeclaration(*$2);                                    $$ = $2;                                 }                               | YYPARAMETER YYSIGNED                                    list_of_param_assignments ';'                                    {                                    callback->paramDeclaration(*$3);                                    $$ = $3;                                 }                               | YYPARAMETER range                                    list_of_param_assignments ';'                                    {                                    callback->realDeclaration(*$2,                                                              *$3);                                    deletePos(2);                                    $$ = $3;                                 }                               | YYPARAMETER YYSIGNED range                                    list_of_param_assignments ';'                                    {                                    callback->paramDeclaration(*$3,                                                               *$4);                                    deletePos(3);                                    $$ = $4;                                 }                               | YYPARAMETER YYINTEGER                                    list_of_param_assignments ';'                                   {                                    callback->paramDeclaration(*$3);                                    $$ = $3;                                 }                               | YYPARAMETER YYREAL 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -