提交 f665c5f3 编写于 作者: 饶先宏's avatar 饶先宏

202106062137

上级 15a51de0
......@@ -261,16 +261,16 @@ assign wCounterin9 = wCounterin8;
hdl4se_binop #(1, 1, 1, BINOP_AND) binop_resetcounter(wButton0NotPressed, nwReset, nwResetCount);
/* 以下是译码器连接,十个计数器的输出对应到十个译码器 */
wire code0[7:0];
wire code1[7:0];
wire code2[7:0];
wire code3[7:0];
wire code4[7:0];
wire code5[7:0];
wire code6[7:0];
wire code7[7:0];
wire code8[7:0];
wire code9[7:0];
wire [7:0] code0;
wire [7:0] code1;
wire [7:0] code2;
wire [7:0] code3;
wire [7:0] code4;
wire [7:0] code5;
wire [7:0] code6;
wire [7:0] code7;
wire [7:0] code8;
wire [7:0] code9;
dec2seg dec0(bCount0, code0);
dec2seg dec1(bCount1, code1);
dec2seg dec2(bCount2, code2);
......
......@@ -129,22 +129,8 @@ module hdl4se_mux16
#(parameter WIDTH=8)
(
input [3:0] sel,
input [WIDTH-1:0] in0,
input [WIDTH-1:0] in1,
input [WIDTH-1:0] in2,
input [WIDTH-1:0] in3,
input [WIDTH-1:0] in4,
input [WIDTH-1:0] in5,
input [WIDTH-1:0] in6,
input [WIDTH-1:0] in7,
input [WIDTH-1:0] in8,
input [WIDTH-1:0] in9,
input [WIDTH-1:0] in10,
input [WIDTH-1:0] in11,
input [WIDTH-1:0] in12,
input [WIDTH-1:0] in13,
input [WIDTH-1:0] in14,
input [WIDTH-1:0] in15,
input [WIDTH-1:0] in0,in1,in2, in3,in4,in5,in6,in7, in8,in9,
in10, in11, in12, in13, in14, in15,
output [WIDTH-1:0] data
);
reg [WIDTH-1:0] data;
......@@ -240,7 +226,7 @@ module hdl4se_bind2
wire [INPUTWIDTH0-1:0] wirein0;
wire [INPUTWIDTH1-1:0] wirein1;
wire [INPUTWIDTH0+INPUTWIDTH1-1:0] wireout;
assign wireout = {wirein1, wirein0};
/* assign wireout = {wirein1, wirein0}; */
endmodule
(*
......@@ -263,7 +249,7 @@ module hdl4se_bind3
wire [INPUTWIDTH1-1:0] wirein1;
wire [INPUTWIDTH2-1:0] wirein2;
wire [INPUTWIDTH0+INPUTWIDTH1+INPUTWIDTH2-1:0] wireout;
assign wireout = {wirein2, wirein1, wirein0};
/*assign wireout = {wirein2, wirein1, wirein0};*/
endmodule
(*
......@@ -289,7 +275,7 @@ module hdl4se_bind4
wire [WIDTH2-1:0] wirein2;
wire [WIDTH3-1:0] wirein3;
wire [WIDTH0+WIDTH1+WIDTH2+WIDTH3-1:0] wireout;
assign wireout = {wirein3, wirein2, wirein1, wirein0};
/*assign wireout = {wirein3, wirein2, wirein1, wirein0};*/
endmodule
(*
......
......@@ -18,9 +18,16 @@ add_library (verilog_parser STATIC
"verilog_root.h"
"verilog_scanner.c"
"verilog_keyword.h"
"verilog_constexpr.h"
"verilog_constexpr.c"
"verilog_port.h" "verilog_port.c" "verilog_vardecl.h" "verilog_vardecl.c")
"verilog_expr.h"
"verilog_expr.c"
"verilog_port.h"
"verilog_port.c"
"verilog_vardecl.h"
"verilog_vardecl.c"
"verilog_paraminst.h"
"verilog_paraminst.c"
"verilog_moduleinst.h"
"verilog_moduleinst.c")
include_directories("../../lcom/include")
include_directories("../hdl4secell/include")
......
......@@ -30,9 +30,10 @@
*/
/*
* verilog_constexpr.c
* verilog_expr.c
修改记录:
202106021610: rxh, initial version
202106061502: rxh, modify from expr to expr
*/
#include "stdio.h"
#include "stdlib.h"
......@@ -42,10 +43,10 @@
#include "dlist.h"
#include "verilog_parsetree.h"
#define IMPLEMENT_GUID
#include "verilog_constexpr.h"
#include "verilog_expr.h"
#undef IMPLEMENT_GUID
typedef struct _sConstExpr {
typedef struct _sExpr {
OBJECT_HEADER
INTERFACE_DECLARE(IVerilogNode)
VERILOGNODE_VARDECLARE
......@@ -60,48 +61,49 @@ typedef struct _sConstExpr {
IVerilogNode** expr1;
IVerilogNode** expr2;
IDListVarPtr attributes;
}sConstExpr;
IDListVarPtr elementselect;
}sExpr;
OBJECT_FUNCDECLARE(constexpr, CLSID_VERILOG_CONSTEXPR);
OBJECT_FUNCDECLARE(expr, CLSID_VERILOG_EXPR);
VERILOGNODE_FUNCDECLARE(constexpr, CLSID_VERILOG_CONSTEXPR, sConstExpr);
DLIST_FUNCIMPL(constexpr, CLSID_VERILOG_CONSTEXPR, sConstExpr);
OBJECT_FUNCIMPL(constexpr, sConstExpr, CLSID_VERILOG_CONSTEXPR);
VERILOGNODE_FUNCDECLARE(expr, CLSID_VERILOG_EXPR, sExpr);
DLIST_FUNCIMPL(expr, CLSID_VERILOG_EXPR, sExpr);
OBJECT_FUNCIMPL(expr, sExpr, CLSID_VERILOG_EXPR);
QUERYINTERFACE_BEGIN(constexpr, CLSID_VERILOG_CONSTEXPR)
QUERYINTERFACE_ITEM(IID_VERILOG_NODE, IVerilogNode, sConstExpr)
QUERYINTERFACE_ITEM(IID_DLIST, IDList, sConstExpr)
QUERYINTERFACE_BEGIN(expr, CLSID_VERILOG_EXPR)
QUERYINTERFACE_ITEM(IID_VERILOG_NODE, IVerilogNode, sExpr)
QUERYINTERFACE_ITEM(IID_DLIST, IDList, sExpr)
QUERYINTERFACE_END
static const char *constexprModuleInfo()
static const char *exprModuleInfo()
{
return "1.0.0-20210602.1612 Constant Expression ";
return "1.1.0-20210606.1504 Expression ";
}
static int constexprCreate(const PARAMITEM * pParams, int paramcount, HOBJECT * pObject)
static int exprCreate(const PARAMITEM * pParams, int paramcount, HOBJECT * pObject)
{
sConstExpr * pobj;
pobj = (sConstExpr *)malloc(sizeof(sConstExpr));
sExpr * pobj;
pobj = (sExpr *)malloc(sizeof(sExpr));
if (pobj == NULL)
return -1;
memset(pobj, 0, sizeof(sConstExpr));
memset(pobj, 0, sizeof(sExpr));
*pObject = 0;
DLIST_VARINIT(pobj, constexpr);
VERILOGNODE_VARINIT(pobj, CLSID_VERILOG_CONSTEXPR);
INTERFACE_INIT(IVerilogNode, pobj, constexpr, verilognode);
DLIST_VARINIT(pobj, expr);
VERILOGNODE_VARINIT(pobj, CLSID_VERILOG_EXPR);
INTERFACE_INIT(IVerilogNode, pobj, expr, verilognode);
/*返回生成的对象*/
OBJECT_RETURN_GEN(constexpr, pobj, pObject, CLSID_VERILOG_CONSTEXPR);
OBJECT_RETURN_GEN(expr, pobj, pObject, CLSID_VERILOG_EXPR);
return EIID_OK;
}
static void constexprDestroy(HOBJECT object)
static void exprDestroy(HOBJECT object)
{
sConstExpr * pobj;
pobj = (sConstExpr *)objectThis(object);
sExpr * pobj;
pobj = (sExpr *)objectThis(object);
if (pobj->value)
free(pobj->value);
objectRelease(pobj->expr0);
......@@ -111,6 +113,8 @@ static void constexprDestroy(HOBJECT object)
objectRelease(pobj->range1);
dlistRemoveAll(pobj->attributes);
objectRelease(pobj->attributes);
dlistRemoveAll(pobj->elementselect);
objectRelease(pobj->elementselect);
free(pobj);
}
......@@ -122,50 +126,18 @@ static void constexprDestroy(HOBJECT object)
0 -- 对象是无效的
1 -- 对象是有效的
*/
static int constexprValid(HOBJECT object)
static int exprValid(HOBJECT object)
{
return 1;
}
static const char* operator_name[] =
{
"!", /*_L_NOT */
"~", /*_B_NOT */
"&", /*_B_AND */
"&~", /*_B_NAND */
"|", /*_B_OR */
"|~", /*_B_NOR */
"^", /*_B_XOR */
"^~", /*_B_EQU */
"+", /*_PLUS */
"-", /*_MINUS */
"*", /*_MUL */
"/", /*_DIV */
"%", /*_MOD */
"**", /*_POW */
"==", /*_L_EQ */
"!=", /*_L_NEQ */
"===", /*_C_EQ */
"!==", /*_C_NEQ */
"&&", /*_L_AND */
"||", /*_L_OR */
"<", /*_LT */
"<=", /*_LTE */
">", /*_GT */
">=", /*_GTE */
">>", /*_LSR */
"<<", /*_LSL */
">>>", /*_ASR */
"<<<", /*_ASL */
};
static int output_operator(FILE* pFile, int opt, int op)
{
fprintf(pFile, operator_name[op]);
}
static int output_attributes(FILE* pFile, int opt, sConstExpr* pobj)
static int output_attributes(FILE* pFile, int opt, sExpr* pobj)
{
if (dlistItemCount(pobj->attributes) > 0) {
fprintf(pFile, "(* ");
......@@ -175,31 +147,31 @@ static int output_attributes(FILE* pFile, int opt, sConstExpr* pobj)
return 0;
}
static int constexpr_verilognode_dump(HOBJECT object, FILE * pFile, int opt)
static int expr_verilognode_dump(HOBJECT object, FILE * pFile, int opt)
{
sConstExpr * pobj;
pobj = (sConstExpr *)objectThis(object);
sExpr * pobj;
pobj = (sExpr *)objectThis(object);
switch (pobj->exprtype) {
case CONSTEXPRTYPE_NUMBER:
case CONSTEXPRTYPE_STRING:
case EXPRTYPE_NUMBER:
case EXPRTYPE_STRING:
fprintf(pFile, pobj->value);
break;
case CONSTEXPRTYPE_PARAM:
case CONSTEXPRTYPE_LOCALPARAM:
case EXPRTYPE_PARAM:
case EXPRTYPE_LOCALPARAM:
fprintf(pFile, pobj->value);
break;
case CONSTEXPRTYPE_BINOP:
case EXPRTYPE_BINOP:
objectCall2(pobj->expr0, dump, pFile, opt);
output_operator(pFile, opt, pobj->op);
output_attributes(pFile, opt, pobj);
objectCall2(pobj->expr1, dump, pFile, opt);
break;
case CONSTEXPRTYPE_UNOP:
case EXPRTYPE_UNOP:
output_operator(pFile, opt, pobj->op);
output_attributes(pFile, opt, pobj);
objectCall2(pobj->expr0, dump, pFile, opt);
break;
case CONSTEXPRTYPE_IFOP:
case EXPRTYPE_IFOP:
objectCall2(pobj->expr0, dump, pFile, opt);
fprintf(pFile, "?");
output_attributes(pFile, opt, pobj);
......@@ -214,7 +186,7 @@ static int constexpr_verilognode_dump(HOBJECT object, FILE * pFile, int opt)
return 0;
}
HOBJECT verilogparseCreateConstExpr(
HOBJECT verilogparseCreateExpr(
int exprtype,
const char* value,
HOBJECT range0,
......@@ -223,16 +195,17 @@ HOBJECT verilogparseCreateConstExpr(
HOBJECT expr0,
HOBJECT expr1,
HOBJECT expr2,
IDListVarPtr attributes
IDListVarPtr attributes,
IDListVarPtr elementselect
)
{
HOBJECT constexpr = NULL;
sConstExpr * pobj;
A_u_t_o_registor_constexpr();
objectCreate(CLSID_VERILOG_CONSTEXPR, NULL, 0, &constexpr);
if (constexpr == NULL)
HOBJECT expr = NULL;
sExpr * pobj;
A_u_t_o_registor_expr();
objectCreate(CLSID_VERILOG_EXPR, NULL, 0, &expr);
if (expr == NULL)
return NULL;
pobj = (sConstExpr *)objectThis(constexpr);
pobj = (sExpr *)objectThis(expr);
if (value != NULL)
pobj->value = strdup(value);
else
......@@ -240,6 +213,7 @@ HOBJECT verilogparseCreateConstExpr(
pobj->exprtype = exprtype;
pobj->op = op;
pobj->attributes = attributes;
pobj->elementselect = elementselect;
objectQueryInterface(expr0, IID_VERILOG_NODE, (void**)&pobj->expr0);
objectRelease(expr0);
objectQueryInterface(expr1, IID_VERILOG_NODE, (void**)&pobj->expr1);
......@@ -250,7 +224,7 @@ HOBJECT verilogparseCreateConstExpr(
objectRelease(range0);
objectQueryInterface(range1, IID_VERILOG_NODE, (void**)&pobj->range1);
objectRelease(range1);
return constexpr;
return expr;
}
......@@ -30,13 +30,14 @@
*/
/*
* verilog_constexpr.h
* verilog_expr.h
修改记录:
202106021601: rxh, initial version
202106061459: rxh, modify from constexpr to expr
*/
#ifndef __VERILOG_CONSTEXPR_H
#define __VERILOG_CONSTEXPR_H
#ifndef __VERILOG_EXPR_H
#define __VERILOG_EXPR_H
#ifdef __cplusplus
extern "C" {
......@@ -46,18 +47,19 @@ extern "C" {
#include "guid.h"
DEFINE_GUID(CLSID_VERILOG_CONSTEXPR, 0xa74d1de6, 0x2c4d, 0x42a6, 0x91, 0xd4, 0x77, 0xf5, 0x62, 0x76, 0x7a, 0x1e);
DEFINE_GUID(CLSID_VERILOG_EXPR, 0xa74d1de6, 0x2c4d, 0x42a6, 0x91, 0xd4, 0x77, 0xf5, 0x62, 0x76, 0x7a, 0x1e);
HOBJECT verilogparseCreateConstExpr(
int exprtype,
const char * value,
HOBJECT range0,
HOBJECT range1,
int op,
HOBJECT expr0,
HOBJECT expr1,
HOBJECT expr2,
IDListVarPtr attributes
HOBJECT verilogparseCreateExpr(
int exprtype,
const char* value,
HOBJECT range0,
HOBJECT range1,
int op,
HOBJECT expr0,
HOBJECT expr1,
HOBJECT expr2,
IDListVarPtr attributes,
IDListVarPtr elementselect
);
#endif
......
......@@ -56,22 +56,24 @@ typedef struct _sVerilogModule {
IDListVar * attributes;
IDListVar * module_parameters;
IDListVar * module_ports;
IDListVar * net_declarations;
IDListVar * always_blocks;
IDListVar * reg_declarations;
IDListVar * continuous_assignments;
IDListVar * event_declarations;
IDListVar * module_instantiations;
IDListVar * initial_blocks;
IDListVar * always_blocks;
IDListVar * event_declarations;
IDListVar * function_declarations;
IDListVar * gate_instantiations;
IDListVar * genvar_declarations;
IDListVar * generate_blocks;
IDListVar * initial_blocks;
IDListVar * integer_declarations;
IDListVar * local_parameters;
IDListVar * module_instantiations;
IDListVar * parameter_overrides;
IDListVar * real_declarations;
IDListVar * realtime_declarations;
IDListVar * reg_declarations;
IDListVar * specify_blocks;
IDListVar * specparams;
IDListVar * task_declarations;
......@@ -159,9 +161,26 @@ static int verilogmodule_verilognode_dump(HOBJECT object, FILE * pFile, int opt)
fprintf(pFile, "\n)\n");
}
fprintf(pFile, ";\n");
/*module items*/
#define dump_module_items(item) \
if (dlistItemCount(pModule->item) > 0) { \
verilog_dump_node_list(pModule->item, pFile, opt, ""); \
}
dump_module_items(net_declarations);
dump_module_items(reg_declarations);
dump_module_items(event_declarations);
dump_module_items(function_declarations);
dump_module_items(task_declarations);
dump_module_items(continuous_assignments);
dump_module_items(module_instantiations);
dump_module_items(initial_blocks);
dump_module_items(always_blocks);
fprintf(pFile, "endmodule\n");
return 0;
}
......@@ -185,122 +204,6 @@ HOBJECT verilogparseCreateModuleDeclaration(
pModule->module_parameters = parameters;
pModule->module_ports = ports;
/*
for(i = 0; i < constructs -> items; i++)
{
ast_module_item * construct = ast_list_get(constructs, i);
if(construct -> type == MOD_ITEM_PORT_DECLARATION && ports == NULL){
// Only accept ports declared this way iff the ports argument to
// this function is NULL, signifying the old style of port
// declaration.
ast_list_append(tr -> module_ports,
construct -> port_declaration);
}
else if(construct -> type == MOD_ITEM_GENERATED_INSTANTIATION){
ast_list_append(tr -> generate_blocks,
construct -> generated_instantiation);
}
else if(construct -> type == MOD_ITEM_PARAMETER_DECLARATION) {
ast_list_append(tr -> module_parameters,
construct -> parameter_declaration);
}
else if(construct -> type == MOD_ITEM_SPECIFY_BLOCK){
ast_list_append(tr -> specify_blocks,
construct -> specify_block);
}
else if(construct -> type == MOD_ITEM_SPECPARAM_DECLARATION){
ast_list_append(tr -> specparams,
construct -> specparam_declaration);
}
else if(construct -> type == MOD_ITEM_PARAMETER_OVERRIDE){
ast_list_append(tr -> parameter_overrides,
construct -> parameter_override);
}
else if(construct -> type == MOD_ITEM_CONTINOUS_ASSIGNMENT){
ast_list_append(tr -> continuous_assignments,
construct -> continuous_assignment);
}
else if(construct -> type == MOD_ITEM_GATE_INSTANTIATION){
ast_list_append(tr -> gate_instantiations,
construct -> gate_instantiation);
}
else if(construct -> type == MOD_ITEM_UDP_INSTANTIATION){
ast_list_append(tr -> udp_instantiations,
construct -> udp_instantiation);
}
else if(construct -> type == MOD_ITEM_MODULE_INSTANTIATION){
ast_list_append(tr -> module_instantiations,
construct -> module_instantiation);
}
else if(construct -> type == MOD_ITEM_INITIAL_CONSTRUCT){
ast_statement_block * toadd = ast_extract_statement_block(
BLOCK_SEQUENTIAL_INITIAL, construct -> initial_construct);
ast_list_append(tr -> initial_blocks ,toadd);
}
else if(construct -> type == MOD_ITEM_ALWAYS_CONSTRUCT){
ast_statement_block * toadd = ast_extract_statement_block(
BLOCK_SEQUENTIAL_ALWAYS, construct -> always_construct);
ast_list_append(tr -> always_blocks,toadd);
}
else if(construct -> type == MOD_ITEM_NET_DECLARATION){
tr -> net_declarations = ast_list_concat(
tr -> net_declarations,
ast_new_net_declaration(construct -> net_declaration));
}
else if(construct -> type == MOD_ITEM_REG_DECLARATION){
tr -> reg_declarations = ast_list_concat(
tr -> reg_declarations,
ast_new_reg_declaration(construct -> reg_declaration));
}
else if(construct -> type == MOD_ITEM_INTEGER_DECLARATION){
tr -> integer_declarations = ast_list_concat(
tr -> integer_declarations,
ast_new_var_declaration(construct -> integer_declaration));
}
else if(construct -> type == MOD_ITEM_REAL_DECLARATION){
tr -> real_declarations = ast_list_concat(
tr -> real_declarations,
ast_new_var_declaration(construct -> real_declaration));
}
else if(construct -> type == MOD_ITEM_TIME_DECLARATION){
tr -> time_declarations = ast_list_concat(
tr -> time_declarations,
ast_new_var_declaration(construct -> time_declaration));
}
else if(construct -> type == MOD_ITEM_REALTIME_DECLARATION){
tr -> realtime_declarations = ast_list_concat(
tr -> realtime_declarations,
ast_new_var_declaration(construct -> realtime_declaration));
}
else if(construct -> type == MOD_ITEM_EVENT_DECLARATION){
tr -> event_declarations = ast_list_concat(
tr -> event_declarations,
ast_new_var_declaration(construct -> event_declaration));
}
else if(construct -> type == MOD_ITEM_GENVAR_DECLARATION){
tr -> genvar_declarations = ast_list_concat(
tr -> genvar_declarations,
ast_new_var_declaration(construct -> genvar_declaration));
}
else if(construct -> type == MOD_ITEM_TASK_DECLARATION){
ast_list_append(tr -> task_declarations,
construct -> task_declaration);
}
else if(construct -> type == MOD_ITEM_FUNCTION_DECLARATION){
ast_list_append(tr -> function_declarations,
construct -> function_declaration);
}
else
{
printf("ERROR: Unsupported module construct type: %d\n",
construct -> type);
assert(0); // Fail out because this should *never* happen
}
}
return tr;
}*/
return module;
}
......@@ -316,6 +219,12 @@ int verilogparseAddModuleItems(HOBJECT object, IDListVarPtr itemlist, int type)
dlistConcat(pModule->net_declarations, itemlist);
return 0;
}
if (type == MODULE_ITEM_TYPE_MODULE_INSTANCE) {
if (pModule->module_instantiations == NULL)
pModule->module_instantiations = dlistCreate();
dlistConcat(pModule->module_instantiations, itemlist);
return 0;
}
return -2;
}
......
......@@ -57,6 +57,7 @@ HOBJECT verilogparseCreateModuleDeclaration(
enum MODULE_ITEM_TYPE {
MODULE_ITEM_TYPE_NET_DECLARATION,
MODULE_ITEM_TYPE_MODULE_INSTANCE,
};
int verilogparseAddModuleItems(HOBJECT object, IDListVarPtr itemlist, int type);
......
/*
** HDL4SE: 软件Verilog综合仿真平台
** Copyright (C) 2021-2021, raoxianhong<raoxianhong@163.net>
** LCOM: 轻量级组件对象模型
** Copyright (C) 2021-2021, raoxianhong<raoxianhong@163.net>
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
**
** * Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation
** and/or other materials provided with the distribution.
** * The name of the author may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY moduleinstESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
** THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* verilog_moduleinst.c
修改记录:
202106062114: rxh, initial version
*/
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "object.h"
#include "dlist.h"
#include "verilog_parsetree.h"
#define IMPLEMENT_GUID
#include "verilog_moduleinst.h"
#undef IMPLEMENT_GUID
typedef struct _sModuleInst {
OBJECT_HEADER
INTERFACE_DECLARE(IVerilogNode)
VERILOGNODE_VARDECLARE
DLIST_VARDECLARE
const char* instname;
int range_type;
HOBJECT range_msb;
HOBJECT range_lsb;
IDListVarPtr port_connections;
IDListVarPtr attributes;
const char* modulename;
IDListVarPtr parameter_value_assignment;
}sModuleInst;
OBJECT_FUNCDECLARE(moduleinst, CLSID_VERILOG_MODULEINST);
VERILOGNODE_FUNCDECLARE(moduleinst, CLSID_VERILOG_MODULEINST, sModuleInst);
DLIST_FUNCIMPL(moduleinst, CLSID_VERILOG_MODULEINST, sModuleInst);
OBJECT_FUNCIMPL(moduleinst, sModuleInst, CLSID_VERILOG_MODULEINST);
QUERYINTERFACE_BEGIN(moduleinst, CLSID_VERILOG_MODULEINST)
QUERYINTERFACE_ITEM(IID_VERILOG_NODE, IVerilogNode, sModuleInst)
QUERYINTERFACE_ITEM(IID_DLIST, IDList, sModuleInst)
QUERYINTERFACE_END
static const char *moduleinstModuleInfo()
{
return "1.0.0-20210606.2115 module instance ";
}
static int moduleinstCreate(const PARAMITEM * pParams, int paramcount, HOBJECT * pObject)
{
sModuleInst * pobj;
pobj = (sModuleInst *)malloc(sizeof(sModuleInst));
if (pobj == NULL)
return -1;
memset(pobj, 0, sizeof(sModuleInst));
*pObject = 0;
DLIST_VARINIT(pobj, moduleinst);
VERILOGNODE_VARINIT(pobj, CLSID_VERILOG_MODULEINST);
INTERFACE_INIT(IVerilogNode, pobj, moduleinst, verilognode);
/*返回生成的对象*/
OBJECT_RETURN_GEN(moduleinst, pobj, pObject, CLSID_VERILOG_MODULEINST);
return EIID_OK;
}
static void moduleinstDestroy(HOBJECT object)
{
sModuleInst * pobj;
pobj = (sModuleInst *)objectThis(object);
if (pobj->instname)
free(pobj->instname);
if (pobj->modulename)
free(pobj->modulename);
objectRelease(pobj->range_msb);
objectRelease(pobj->range_lsb);
dlistRemoveAll(pobj->attributes);
objectRelease(pobj->attributes);
dlistRemoveAll(pobj->port_connections);
objectRelease(pobj->port_connections);
dlistRemoveAll(pobj->parameter_value_assignment);
objectRelease(pobj->parameter_value_assignment);
free(pobj);
}
/*
功能:判断对象是否是一个有效对象
参数:
object -- 对象数据指针
返回值:
0 -- 对象是无效的
1 -- 对象是有效的
*/
static int moduleinstValid(HOBJECT object)
{
return 1;
}
static int output_attributes(FILE* pFile, int opt, sModuleInst* pobj)
{
if (dlistItemCount(pobj->attributes) > 0) {
fprintf(pFile, "(* ");
verilog_dump_node_list(pobj->attributes, pFile, opt, ", ");
fprintf(pFile, " *) ");
}
return 0;
}
static int moduleinst_verilognode_dump(HOBJECT object, FILE * pFile, int opt)
{
sModuleInst * pobj;
pobj = (sModuleInst *)objectThis(object);
fprintf(pFile, " %s", pobj->modulename);
fprintf(pFile, " %s", pobj->instname);
fprintf(pFile, ";\n");
return 0;
}
HOBJECT verilogparseCreateModuleInstance(
const char* instname,
int range_type,
HOBJECT range_msb,
HOBJECT range_lsb,
IDListVarPtr port_connections
)
{
HOBJECT moduleinst = NULL;
sModuleInst * pobj;
A_u_t_o_registor_moduleinst();
objectCreate(CLSID_VERILOG_MODULEINST, NULL, 0, &moduleinst);
if (moduleinst == NULL)
return NULL;
pobj = (sModuleInst *)objectThis(moduleinst);
if (instname != NULL)
pobj->instname = strdup(instname);
objectQueryInterface(range_msb, IID_VERILOG_NODE, (void**)&pobj->range_msb);
objectRelease(range_msb);
objectQueryInterface(range_lsb, IID_VERILOG_NODE, (void**)&pobj->range_lsb);
objectRelease(range_lsb);
pobj->port_connections = port_connections;
return moduleinst;
}
;
int verilogparseSetModuleInstanceOption(
HOBJECT inst,
IDListVarPtr attributes,
const char* modulename,
IDListVarPtr parameter_value_assignment
) {
sModuleInst* pobj;
if (!objectIsClass(inst, CLSID_VERILOG_MODULEINST)) {
return -1;
}
pobj = (sModuleInst*)objectThis(inst);
pobj->attributes = attributes;
pobj->modulename = strdup(modulename);
pobj->parameter_value_assignment = parameter_value_assignment;
objectAddRef(attributes);
objectAddRef(parameter_value_assignment);
return 0;
}
\ No newline at end of file
/*
** HDL4SE: 软件Verilog综合仿真平台
** Copyright (C) 2021-2021, raoxianhong<raoxianhong@163.net>
** LCOM: 轻量级组件对象模型
** Copyright (C) 2021-2021, raoxianhong<raoxianhong@163.net>
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
**
** * Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation
** and/or other materials provided with the distribution.
** * The name of the author may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
** THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* verilog_moduleinst.h
修改记录:
202106062103: rxh, initial version
*/
#ifndef __VERILOG_MODULEINST_H
#define __VERILOG_MODULEINST_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
#include "guid.h"
DEFINE_GUID(CLSID_VERILOG_MODULEINST, 0xcbf438d3, 0x81d6, 0x4289, 0xb5, 0x89, 0xae, 0x11, 0x2e, 0x22, 0x97, 0x6d);
HOBJECT verilogparseCreateModuleInstance(
const char * instname,
int range_type,
HOBJECT range_msb,
HOBJECT range_lsb,
IDListVarPtr port_connections
);
int verilogparseSetModuleInstanceOption(
HOBJECT inst,
IDListVarPtr attributes,
const char * modulename,
IDListVarPtr parameter_value_assignment
);
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
** HDL4SE: 软件Verilog综合仿真平台
** Copyright (C) 2021-2021, raoxianhong<raoxianhong@163.net>
** LCOM: 轻量级组件对象模型
** Copyright (C) 2021-2021, raoxianhong<raoxianhong@163.net>
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
**
** * Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation
** and/or other materials provided with the distribution.
** * The name of the author may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY paraminstESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
** THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* verilog_paraminst.c
修改记录:
202106061905: rxh, initial version
*/
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "object.h"
#include "dlist.h"
#include "verilog_parsetree.h"
#define IMPLEMENT_GUID
#include "verilog_paraminst.h"
#undef IMPLEMENT_GUID
typedef struct _sParamInst {
OBJECT_HEADER
INTERFACE_DECLARE(IVerilogNode)
VERILOGNODE_VARDECLARE
DLIST_VARDECLARE
int index;
const char* name;
int exprcount;
IVerilogNode** expr0;
IVerilogNode** expr1;
IVerilogNode** expr2;
IDListVarPtr attributes;
}sParamInst;
OBJECT_FUNCDECLARE(paraminst, CLSID_VERILOG_PARAMINST);
VERILOGNODE_FUNCDECLARE(paraminst, CLSID_VERILOG_PARAMINST, sParamInst);
DLIST_FUNCIMPL(paraminst, CLSID_VERILOG_PARAMINST, sParamInst);
OBJECT_FUNCIMPL(paraminst, sParamInst, CLSID_VERILOG_PARAMINST);
QUERYINTERFACE_BEGIN(paraminst, CLSID_VERILOG_PARAMINST)
QUERYINTERFACE_ITEM(IID_VERILOG_NODE, IVerilogNode, sParamInst)
QUERYINTERFACE_ITEM(IID_DLIST, IDList, sParamInst)
QUERYINTERFACE_END
static const char *paraminstModuleInfo()
{
return "1.0.0-20210606.1905 param instance ";
}
static int paraminstCreate(const PARAMITEM * pParams, int paramcount, HOBJECT * pObject)
{
sParamInst * pobj;
pobj = (sParamInst *)malloc(sizeof(sParamInst));
if (pobj == NULL)
return -1;
memset(pobj, 0, sizeof(sParamInst));
*pObject = 0;
DLIST_VARINIT(pobj, paraminst);
VERILOGNODE_VARINIT(pobj, CLSID_VERILOG_PARAMINST);
INTERFACE_INIT(IVerilogNode, pobj, paraminst, verilognode);
/*返回生成的对象*/
OBJECT_RETURN_GEN(paraminst, pobj, pObject, CLSID_VERILOG_PARAMINST);
return EIID_OK;
}
static void paraminstDestroy(HOBJECT object)
{
sParamInst * pobj;
pobj = (sParamInst *)objectThis(object);
if (pobj->name)
free(pobj->name);
objectRelease(pobj->expr0);
objectRelease(pobj->expr1);
objectRelease(pobj->expr2);
dlistRemoveAll(pobj->attributes);
objectRelease(pobj->attributes);
free(pobj);
}
/*
功能:判断对象是否是一个有效对象
参数:
object -- 对象数据指针
返回值:
0 -- 对象是无效的
1 -- 对象是有效的
*/
static int paraminstValid(HOBJECT object)
{
return 1;
}
static int output_attributes(FILE* pFile, int opt, sParamInst* pobj)
{
if (dlistItemCount(pobj->attributes) > 0) {
fprintf(pFile, "(* ");
verilog_dump_node_list(pobj->attributes, pFile, opt, ", ");
fprintf(pFile, " *) ");
}
return 0;
}
static int paraminst_verilognode_dump(HOBJECT object, FILE * pFile, int opt)
{
sParamInst * pobj;
pobj = (sParamInst *)objectThis(object);
return 0;
}
HOBJECT verilogparseCreateParamInstance(
const char* name,
int exprcount,
HOBJECT expr0,
HOBJECT expr1,
HOBJECT expr2,
IDListVarPtr attributes
)
{
HOBJECT paraminst = NULL;
sParamInst * pobj;
A_u_t_o_registor_paraminst();
objectCreate(CLSID_VERILOG_PARAMINST, NULL, 0, &paraminst);
if (paraminst == NULL)
return NULL;
pobj = (sParamInst *)objectThis(paraminst);
if (name != NULL)
pobj->name = strdup(name);
else
pobj->name = NULL;
pobj->index = -1;
pobj->exprcount = exprcount;
pobj->attributes = attributes;
objectQueryInterface(expr0, IID_VERILOG_NODE, (void**)&pobj->expr0);
objectRelease(expr0);
objectQueryInterface(expr1, IID_VERILOG_NODE, (void**)&pobj->expr1);
objectRelease(expr1);
objectQueryInterface(expr2, IID_VERILOG_NODE, (void**)&pobj->expr2);
objectRelease(expr2);
return paraminst;
}
int verilogparseSetParamInstanceIndex(
HOBJECT paraminst,
int index
) {
sParamInst* pobj;
if (!objectIsClass(paraminst, CLSID_VERILOG_PARAMINST)) {
return -1;
}
pobj = (sParamInst*)objectThis(paraminst);
pobj->index = index;
return 0;
}
\ No newline at end of file
/*
** HDL4SE: 软件Verilog综合仿真平台
** Copyright (C) 2021-2021, raoxianhong<raoxianhong@163.net>
** LCOM: 轻量级组件对象模型
** Copyright (C) 2021-2021, raoxianhong<raoxianhong@163.net>
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
**
** * Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation
** and/or other materials provided with the distribution.
** * The name of the author may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
** THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* verilog_paraminst.h
修改记录:
202106061856: rxh, initial version
*/
#ifndef __VERILOG_PARAMINST_H
#define __VERILOG_PARAMINST_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
#include "guid.h"
DEFINE_GUID(CLSID_VERILOG_PARAMINST, 0xf3d79b55, 0xfd54, 0x40fd, 0x8d, 0xa0, 0x5d, 0xbb, 0x4b, 0x7c, 0xfb, 0x97);
HOBJECT verilogparseCreateParamInstance(
const char* name,
int exprcount,
HOBJECT expr0,
HOBJECT expr1,
HOBJECT expr2,
IDListVarPtr attributes
);
int verilogparseSetParamInstanceIndex(
HOBJECT paraminst,
int index
);
#endif
#ifdef __cplusplus
}
#endif
#endif
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -57,11 +57,13 @@ extern int yydebug;
#include "verilog_keyword.h"
#include "verilog_attrspec.h"
#include "verilog_parameter.h"
#include "verilog_constexpr.h"
#include "verilog_expr.h"
#include "verilog_port.h"
#include "verilog_vardecl.h"
#include "verilog_paraminst.h"
#include "verilog_moduleinst.h"
#line 65 "D:/gitwork/hdl4se/parser/verilog_parser.h"
#line 67 "D:/gitwork/hdl4se/parser/verilog_parser.h"
/* Token kinds. */
#ifndef YYTOKENTYPE
......@@ -265,14 +267,15 @@ extern int yydebug;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 92 "D:/gitwork/hdl4se/parser/verilog_parser.y"
#line 94 "D:/gitwork/hdl4se/parser/verilog_parser.y"
HOBJECT treenode;
HOBJECT obj;
struct _two_obj {
int type;
HOBJECT obj[2];
}two_obj;
struct _mul_obj {
int type;
int objcount;
HOBJECT obj[16];
}mul_obj;
struct _str_bind_obj {
const char * key;
HOBJECT obj;
......@@ -283,7 +286,7 @@ union YYSTYPE
int ival;
IDListVar* list;
#line 287 "D:/gitwork/hdl4se/parser/verilog_parser.h"
#line 290 "D:/gitwork/hdl4se/parser/verilog_parser.h"
};
typedef union YYSTYPE YYSTYPE;
......
......@@ -83,19 +83,22 @@
#include "verilog_keyword.h"
#include "verilog_attrspec.h"
#include "verilog_parameter.h"
#include "verilog_constexpr.h"
#include "verilog_expr.h"
#include "verilog_port.h"
#include "verilog_vardecl.h"
#include "verilog_paraminst.h"
#include "verilog_moduleinst.h"
}
/* token types */
%union {
HOBJECT treenode;
HOBJECT obj;
struct _two_obj {
int type;
HOBJECT obj[2];
}two_obj;
struct _mul_obj {
int type;
int objcount;
HOBJECT obj[16];
}mul_obj;
struct _str_bind_obj {
const char * key;
HOBJECT obj;
......@@ -160,6 +163,7 @@
%type <string> attr_name identifier module_identifier
topmodule_identifier parameter_identifier
port_identifier net_identifier
module_instance_identifier
number string unsigned_number
%type <ival> parameter_type
......@@ -169,10 +173,13 @@
unary_module_path_operator
binary_module_path_operator
net_type net_type_option output_variable_type
vectored_or_scalared_option
vectored_or_scalared_option vectored_option scalared_option
%type <two_obj> range range_option constant_range_expression dimension
%type <mul_obj> range range_option constant_range_expression dimension
delay3 delay3_option delay2 delay2_option
mintypmax_expression mintypmax_expression_option
%type <str_bind_obj> port_ident param_assignment net_decl_assignment
var var_part
%type <treenode> attr_spec
%type <treenode> constant_mintypmax_expression constant_primary
......@@ -185,6 +192,12 @@
msb_constant_expression
lsb_constant_expression
dimension_constant_expression
delay_value
expression expression_option
primary conditional_expression base_expression
module_instance
ordered_parameter_assignment named_parameter_assignment
named_port_connection ordered_port_connection
%type <list> attribute_instance_list attribute_instance attribute_instance_spec_list
......@@ -194,11 +207,17 @@
%type <list> module_parameter_port_list module_param_list
list_of_param_assignments port_declaration_list
list_of_port_connections_option
%type <list> module_instance_list parameter_value_assignment_option parameter_value_assignment
list_of_parameter_assignments ordered_parameter_assignment_list named_parameter_assignment_list
list_of_port_connections ordered_port_connection_list named_port_connection_list
%type <list> list_of_port_declarations
list_of_ports module_item_list non_port_module_item_list
ports port_declarations port_expression
%%
/* Start variables */
......@@ -687,7 +706,7 @@ module_or_generate_item :
}
| attribute_instance_list udp_instantiation {
}
| attribute_instance_list module_instantiation {
| module_instantiation {
}
| attribute_instance_list initial_construct {
}
......@@ -968,8 +987,10 @@ integer_declaration : KW_INTEGER list_of_variable_identifiers ';' {
;
delay3_option:
%empty {
$$.objcount = 0;
}
| delay3 {
$$ = $1;
}
;
......@@ -982,15 +1003,19 @@ drive_strength_option :
vectored_option :
%empty {
$$ = VS_NONE;
}
| KW_VECTORED {
$$ = VS_VECTORED;
}
;
scalared_option :
%empty {
$$ = VS_NONE;
}
| KW_SCALARED {
$$ = VS_SCALARED;
}
;
......@@ -1031,13 +1056,33 @@ net_declaration :
}
|*/
attribute_instance_list net_type drive_strength_option vectored_or_scalared_option signed_option
range_option delay3_option list_of_net_identifiers ';' {
range_option delay3_option list_of_net ';' {
if (currentmodule == NULL) {
yyerror("no current module");
} else {
IDListVar* list;
IDListVarPtr pitem, pitemtemp;
list = dlistCreate();
pitem = $8->__dlist_pNext;
while (!IsDListHeader(pitem)) {
pitemtemp = pitem->__dlist_pNext;
dlistDetach(pitem);
verilogparseVarDeclSetOptions(pitem,
$2, //int type,
$1, //IDListVar* attributes,
$4, //int vectored_or_scalared,
$5, //int issigned,
$6.type, //int range_type,
$6.obj[0], //HOBJECT range_msb,
$6.obj[1], //HOBJECT range_lsb,
$7.objcount<=0?NULL:$7.obj[0], //HOBJECT delay0,
$7.objcount<=1?NULL:$7.obj[1], //HOBJECT delay1,
$7.objcount<=2?NULL:$7.obj[2] //HOBJECT delay2,
);
dlistAppendItem(list, pitem);
pitem = pitemtemp;
}
objectRelease($8);
verilogparseAddModuleItems(currentmodule, list, MODULE_ITEM_TYPE_NET_DECLARATION);
}
}
......@@ -1218,29 +1263,75 @@ A.2.2.3 Delays
delay3 :
'#' delay_value {
$$.objcount = 1;
$$.obj[0] = $2;
}
| '#' '(' mintypmax_expression ')' {
$$ = $3;
}
| '#' '(' mintypmax_expression ',' mintypmax_expression ')' {
$$.objcount = 0;
}
| '#' '(' mintypmax_expression ',' mintypmax_expression ',' mintypmax_expression ')' {
$$.objcount = 0;
}
;
delay2 :
'#' delay_value
'#' delay_value {
$$.objcount = 1;
$$.obj[0] = $2;
}
| '#' '(' mintypmax_expression ')' {
$$ = $3;
}
| '#' '(' mintypmax_expression ',' mintypmax_expression ')' {
$$.objcount = 0;
}
;
delay_value :
unsigned_number {
$$ = verilogparseCreateExpr(
EXPRTYPE_NUMBER, /* int exprtype */
$1, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
0, /* int op, */
NULL, /* HOBJECT expr0, */
NULL, /* HOBJECT expr1, */
NULL, /* HOBJECT expr2, */
NULL, /* IDListVarPtr attribute */
NULL /* IDListVarPtr elementselect */
);
}
| NUM_REAL {
$$ = verilogparseCreateExpr(
EXPRTYPE_NUMBER, /* int exprtype */
$1, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
0, /* int op, */
NULL, /* HOBJECT expr0, */
NULL, /* HOBJECT expr1, */
NULL, /* HOBJECT expr2, */
NULL, /* IDListVarPtr attribute */
NULL /* IDListVarPtr elementselect */
);
}
| identifier {
$$ = verilogparseCreateExpr(
EXPRTYPE_IDENT, /* int exprtype */
$1, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
0, /* int op, */
NULL, /* HOBJECT expr0, */
NULL, /* HOBJECT expr1, */
NULL, /* HOBJECT expr2, */
NULL, /* IDListVarPtr attribute */
NULL /* IDListVarPtr elementselect */
);
}
;
......@@ -1774,8 +1865,10 @@ pull_gate_instance_list:
delay2_option :
%empty {
$$.objcount = 0;
}
| delay2 {
$$ = $1;
}
;
......@@ -1999,119 +2092,239 @@ A.4.1 Module instantiation
*/
parameter_value_assignment_option :
%empty {
$$ = dlistCreate();
}
| parameter_value_assignment {
$$ = $1;
}
;
module_instance_list:
module_instance {
$$ = dlistCreate();
dlistAppendItem($$, $1);
}
| module_instance_list ',' module_instance {
$$ = $1;
dlistAppendItem($$, $3);
}
;
module_instantiation :
module_identifier parameter_value_assignment_option module_instance_list ';' {
attribute_instance_list module_identifier parameter_value_assignment_option module_instance_list ';' {
IDListVarPtr pitem, pitemtemp;
if (dlistItemCount($4) > 0) {
pitem = $4->__dlist_pNext;
while (pitem != $4) {
pitemtemp = pitem->__dlist_pNext;
verilogparseSetModuleInstanceOption(
pitem, //HOBJECT inst,
$1, //IDListVarPtr attributes,
$2, //const char * modulename,
$3 //IDListVarPtr parameter_value_assignment
);
pitem = pitemtemp;
}
verilogparseAddModuleItems(currentmodule, $4, MODULE_ITEM_TYPE_MODULE_INSTANCE);
}
}
;
parameter_value_assignment :
'#' '(' list_of_parameter_assignments ')' {
$$ = $3;
}
;
ordered_parameter_assignment_list:
ordered_parameter_assignment {
$$ = dlistCreate();
dlistAppendItem($$, $1);
}
| ordered_parameter_assignment_list ',' ordered_parameter_assignment {
$$ = $1;
dlistAppendItem($$, $3);
}
;
named_parameter_assignment_list:
named_parameter_assignment {
$$ = dlistCreate();
dlistAppendItem($$, $1);
}
| named_parameter_assignment_list ',' named_parameter_assignment {
$$ = $1;
dlistAppendItem($$, $3);
}
;
list_of_parameter_assignments :
ordered_parameter_assignment_list {
int index;
IDListVarPtr pitem, pitemtemp;
$$ = $1;
index = 0;
if ($$ != NULL) {
pitem = $$->__dlist_pNext;
while (pitem != $$) {
pitemtemp = pitem->__dlist_pNext;
verilogparseSetParamInstanceIndex(pitem, index);
index++;
pitem = pitemtemp;
}
}
}
| named_parameter_assignment_list {
$$ = $1;
}
;
ordered_parameter_assignment :
expression {
$$ = verilogparseCreateParamInstance(
NULL, //const char* name,
1, //int exprcount,
$1, //HOBJECT expr0,
NULL, //HOBJECT expr1,
NULL, //HOBJECT expr2,
NULL //IDListVarPtr attributes
);
}
;
mintypmax_expression_option:
%empty {
$$.objcount = 0;
}
| mintypmax_expression {
$$ = $1;
}
;
named_parameter_assignment :
'.' parameter_identifier '(' mintypmax_expression_option ')' {
$$ = verilogparseCreateParamInstance(
$2, //const char* name,
$4.objcount, //int exprcount,
$4.obj[0], //HOBJECT expr0,
$4.obj[1], //HOBJECT expr1,
$4.obj[2], //HOBJECT expr2,
NULL //IDListVarPtr attributes
);
}
;
list_of_port_connections_option:
%empty {
%empty {
$$ = dlistCreate();
}
| list_of_port_connections {
$$ = $1;
}
;
/*
module_instance :
name_of_module_instance '(' list_of_port_connections_option ')' {
}
;
*/
module_instance :
module_instance_identifier range_option '(' list_of_port_connections_option ')' {
$$ = verilogparseCreateModuleInstance(
$1, //const char * instname,
$2.type, // int range_type,
$2.obj[0], //HOBJECT range_msb,
$2.obj[1], //HOBJECT range_lsb,
$4 //IDListVarPtr port_connections
);
}
;
/*
name_of_module_instance :
module_instance_identifier range_option {
}
;
*/
ordered_port_connection_list:
ordered_port_connection {
$$ = dlistCreate();
dlistAppendItem($$, $1);
}
| ordered_port_connection_list ',' ordered_port_connection {
$$ = $1;
dlistAppendItem($$, $3);
}
;
named_port_connection_list:
named_port_connection {
$$ = dlistCreate();
dlistAppendItem($$, $1);
}
| named_port_connection_list ',' named_port_connection {
$$ = $1;
dlistAppendItem($$, $3);
}
;
list_of_port_connections :
ordered_port_connection_list {
int index;
IDListVarPtr pitem, pitemtemp;
$$ = $1;
index = 0;
if ($$ != NULL) {
pitem = $$->__dlist_pNext;
while (pitem != $$) {
pitemtemp = pitem->__dlist_pNext;
verilogparseSetParamInstanceIndex(pitem, index);
index++;
pitem = pitemtemp;
}
}
}
| named_port_connection_list {
$$ = $1;
}
;
expression_option:
%empty {
$$ = NULL;
}
| expression {
$$ = $1;
}
;
ordered_port_connection :
attribute_instance_list expression_option {
$$ = verilogparseCreateParamInstance(
NULL, //const char* name,
1, //int exprcount,
$2, //HOBJECT expr0,
NULL, //HOBJECT expr1,
NULL, //HOBJECT expr2,
$1 //IDListVarPtr attributes
);
}
;
named_port_connection :
attribute_instance_list '.' port_identifier '(' expression_option ')' {
$$ = verilogparseCreateParamInstance(
$3, //const char* name,
1, //int exprcount,
$5, //HOBJECT expr0,
NULL, //HOBJECT expr1,
NULL, //HOBJECT expr2,
$1 //IDListVarPtr attributes
);
}
;
......@@ -3678,11 +3891,24 @@ A.8.3 Expressions
*/
base_expression :
expression {
$$ = $1;
}
;
conditional_expression :
expression '?' attribute_instance_list expression ':' expression {
$$ = verilogparseCreateExpr(
EXPRTYPE_IFOP, /* int exprtype */
NULL, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
0, /* int op, */
$1, /* HOBJECT expr0, */
$4, /* HOBJECT expr1, */
$6, /* HOBJECT expr2, */
$3, /* IDListVarPtr attribute */
NULL /* IDListVarPtr elementselect */
);
}
;
......@@ -3697,8 +3923,8 @@ constant_expression :
$$ = $1;
}
| unary_operator attribute_instance_list constant_primary {
$$ = verilogparseCreateConstExpr(
CONSTEXPRTYPE_UNOP, /* int exprtype */
$$ = verilogparseCreateExpr(
EXPRTYPE_UNOP, /* int exprtype */
NULL, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
......@@ -3706,12 +3932,13 @@ constant_expression :
$3, /* HOBJECT expr0, */
NULL, /* HOBJECT expr1, */
NULL, /* HOBJECT expr2, */
$2 /*HOBJECT attribute */
$2, /* IDListVarPtr attribute */
NULL /* IDListVarPtr elementselect */
);
}
| constant_expression binary_operator attribute_instance_list constant_expression {
$$ = verilogparseCreateConstExpr(
CONSTEXPRTYPE_BINOP, /* int exprtype */
$$ = verilogparseCreateExpr(
EXPRTYPE_BINOP, /* int exprtype */
NULL, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
......@@ -3719,12 +3946,13 @@ constant_expression :
$1, /* HOBJECT expr0, */
$4, /* HOBJECT expr1, */
NULL, /* HOBJECT expr2, */
$3 /*HOBJECT attribute */
$3, /* IDListVarPtr attribute */
NULL /* IDListVarPtr elementselect */
);
}
| constant_expression '?' attribute_instance_list constant_expression ':' constant_expression {
$$ = verilogparseCreateConstExpr(
CONSTEXPRTYPE_IFOP, /* int exprtype */
$$ = verilogparseCreateExpr(
EXPRTYPE_IFOP, /* int exprtype */
NULL, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
......@@ -3732,7 +3960,8 @@ constant_expression :
$1, /* HOBJECT expr0, */
$4, /* HOBJECT expr1, */
$6, /* HOBJECT expr2, */
$3 /*HOBJECT attribute */
$3, /* IDListVarPtr attribute */
NULL /* IDListVarPtr elementselect */
);
}
;
......@@ -3777,12 +4006,38 @@ dimension_constant_expression :
expression :
primary {
$$ = $1;
}
| unary_operator attribute_instance_list primary {
$$ = verilogparseCreateExpr(
EXPRTYPE_UNOP, /* int exprtype */
NULL, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
$1, /* int op, */
$3, /* HOBJECT expr0, */
NULL, /* HOBJECT expr1, */
NULL, /* HOBJECT expr2, */
$2, /* IDListVarPtr attribute */
NULL /* IDListVarPtr elementselect */
);
}
| expression binary_operator attribute_instance_list expression {
$$ = verilogparseCreateExpr(
EXPRTYPE_BINOP, /* int exprtype */
NULL, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
$2, /* int op, */
$1, /* HOBJECT expr0, */
$4, /* HOBJECT expr1, */
NULL, /* HOBJECT expr2, */
$3, /* IDListVarPtr attribute */
NULL /* IDListVarPtr elementselect */
);
}
| conditional_expression {
$$ = $1;
}
;
......@@ -3800,8 +4055,14 @@ lsb_constant_expression :
mintypmax_expression :
expression {
$$.objcount = 1;
$$.obj[0] = $1;
}
| expression ':' expression ':' expression {
$$.objcount = 3;
$$.obj[0] = $1;
$$.obj[1] = $3;
$$.obj[2] = $5;
}
;
......@@ -3858,8 +4119,8 @@ A.8.4 Primaries
*/
constant_primary :
number {
$$ = verilogparseCreateConstExpr(
CONSTEXPRTYPE_NUMBER, /* int exprtype */
$$ = verilogparseCreateExpr(
EXPRTYPE_NUMBER, /* int exprtype */
$1, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
......@@ -3867,12 +4128,13 @@ constant_primary :
NULL, /* HOBJECT expr0, */
NULL, /* HOBJECT expr1, */
NULL, /* HOBJECT expr2, */
NULL /*HOBJECT attribute */
NULL, /* IDListVarPtr attribute */
NULL /* IDListVarPtr elementselect */
);
}
| parameter_identifier {
$$ = verilogparseCreateConstExpr(
CONSTEXPRTYPE_PARAM, /* int exprtype */
$$ = verilogparseCreateExpr(
EXPRTYPE_PARAM, /* int exprtype */
$1, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
......@@ -3880,7 +4142,8 @@ constant_primary :
NULL, /* HOBJECT expr0, */
NULL, /* HOBJECT expr1, */
NULL, /* HOBJECT expr2, */
NULL /*HOBJECT attribute */
NULL, /* IDListVarPtr attribute */
NULL /* IDListVarPtr elementselect */
);
}
| parameter_identifier '[' constant_range_expression ']' {
......@@ -3908,8 +4171,8 @@ constant_primary :
$$ = NULL;
}
| string {
$$ = verilogparseCreateConstExpr(
CONSTEXPRTYPE_STRING, /* int exprtype */
$$ = verilogparseCreateExpr(
EXPRTYPE_STRING, /* int exprtype */
$1, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
......@@ -3917,7 +4180,8 @@ constant_primary :
NULL, /* HOBJECT expr0, */
NULL, /* HOBJECT expr1, */
NULL, /* HOBJECT expr2, */
NULL /*HOBJECT attribute */
NULL, /* IDListVarPtr attribute */
NULL /* IDListVarPtr elementselect */
);
}
;
......@@ -3994,21 +4258,59 @@ hierarchical_identifier :
var_part :
identifier {
$$.key = $1;
$$.obj = NULL;
}
| identifier '[' expression ']' {
ident_part * part;
part = (ident_part *)malloc(sizeof(ident_part));
$$.key = $1;
part->name = strdup($1);
part->type = RANGE_TYPE_BITSELECT;
part->msb = $3;
$$.obj = hdl4seCreatePtrListItem($1, part);
}
| identifier '[' expression ':' expression ']' {
ident_part * part;
part = (ident_part *)malloc(sizeof(ident_part));
$$.key = $1;
part->name = strdup($1);
part->type = RANGE_TYPE_PARTSELECT;
part->msb = $3;
part->lsb = $5;
$$.obj = hdl4seCreatePtrListItem($1, part);
}
| identifier '[' expression STARTPLUSWIDTH expression ']' {
ident_part * part;
part = (ident_part *)malloc(sizeof(ident_part));
$$.key = $1;
part->name = strdup($1);
part->type = RANGE_TYPE_STARTPLUSWIDTH;
part->msb = $3;
part->lsb = $5;
$$.obj = hdl4seCreatePtrListItem($1, part);
}
| identifier '[' expression STARTMINUSWIDTH expression ']' {
ident_part * part;
part = (ident_part *)malloc(sizeof(ident_part));
$$.key = $1;
part->name = strdup($1);
part->type = RANGE_TYPE_STARTMINUSWIDTH;
part->msb = $3;
part->lsb = $5;
$$.obj = hdl4seCreatePtrListItem($1, part);
}
;
var :
var_part {
$$.key = $1.key;
$$.obj = dlistCreate();
dlistAppendItem((IDListVar *)$$.obj, $1.obj);
}
| var '.' var_part {
$$ = $1;
dlistAppendItem((IDListVar *)$$.obj, $1.obj);
}
;
/*
......@@ -4017,20 +4319,68 @@ var :
primary :
number {
$$ = verilogparseCreateExpr(
EXPRTYPE_NUMBER, /* int exprtype */
$1, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
0, /* int op, */
NULL, /* HOBJECT expr0, */
NULL, /* HOBJECT expr1, */
NULL, /* HOBJECT expr2, */
NULL, /* IDListVarPtr attribute */
NULL /* IDListVarPtr elementselect */
);
}
| var {
$$ = verilogparseCreateExpr(
EXPRTYPE_HIERARCHICAL_IDENT, /* int exprtype */
$1.key, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
0, /* int op, */
NULL, /* HOBJECT expr0, */
NULL, /* HOBJECT expr1, */
NULL, /* HOBJECT expr2, */
NULL, /* IDListVarPtr attribute */
$1.obj /* IDListVarPtr elementselect */
);
}
| concatenation {
$$ = NULL;
yyerror("no support for concatenation");
}
| multiple_concatenation {
$$ = NULL;
yyerror("no support for multiple_concatenation");
}
| function_call {
$$ = NULL;
yyerror("no support for function_call");
}
| system_function_call {
$$ = NULL;
yyerror("no support for system_function_call");
}
| '(' mintypmax_expression ')' {
$$ = $2.obj[0];
if ($2.objcount > 1) {
yyerror("no supprot for mintypmax_expression when objcount > 1");
}
}
| string {
$$ = verilogparseCreateExpr(
EXPRTYPE_STRING, /* int exprtype */
$1, /* const char * value*/
NULL, /* HOBJECT range0, */
NULL, /* HOBJECT range1,*/
0, /* int op, */
NULL, /* HOBJECT expr0, */
NULL, /* HOBJECT expr1, */
NULL, /* HOBJECT expr2, */
NULL, /* IDListVarPtr attribute */
NULL /* IDListVarPtr elementselect */
);
}
;
......@@ -4610,6 +4960,7 @@ module_identifier :
module_instance_identifier :
identifier {
$$ = $1;
}
;
net_identifier : identifier {
......
......@@ -103,20 +103,40 @@ enum VAR_TYPE {
VAR_TYPE_REG,
};
static const char* var_type_name[] = {
"",
"supply0",
"supply1",
"tri",
"triand",
"trior",
"tri0",
"tri1",
"uwire",
"wire",
"wand",
"wor",
"integer",
"time",
"reg",
};
enum VECT_OR_SCALAR {
VS_NONE,
VS_VECTORED,
VS_SCALARED,
};
enum constexprtype {
CONSTEXPRTYPE_NUMBER,
CONSTEXPRTYPE_PARAM,
CONSTEXPRTYPE_LOCALPARAM,
CONSTEXPRTYPE_STRING,
CONSTEXPRTYPE_UNOP,
CONSTEXPRTYPE_BINOP,
CONSTEXPRTYPE_IFOP,
enum exprtype {
EXPRTYPE_NUMBER,
EXPRTYPE_PARAM,
EXPRTYPE_LOCALPARAM,
EXPRTYPE_STRING,
EXPRTYPE_UNOP,
EXPRTYPE_BINOP,
EXPRTYPE_IFOP,
EXPRTYPE_IDENT,
EXPRTYPE_HIERARCHICAL_IDENT,
};
enum RANGE_TYPE {
......@@ -127,6 +147,13 @@ enum RANGE_TYPE {
RANGE_TYPE_STARTMINUSWIDTH,
};
typedef struct _ident_part {
const char* name;
int type;
HOBJECT msb;
HOBJECT lsb;
}ident_part;
enum PORT_DIRECT {
PORT_DIRECT_INPUT,
PORT_DIRECT_INOUT,
......@@ -135,6 +162,14 @@ enum PORT_DIRECT {
PORT_DIRECT_ASPRE,
};
static const char* port_direct_name[] = {
"input ",
"inout ",
"output ",
"", /* UNKOWN */
"error aspre not handled",
};
enum PARAM_TYPE {
PARAM_TYPE_PARAM,
PARAM_TYPE_LOCAL,
......@@ -180,6 +215,38 @@ enum OPERATOR {
OP_ASL,
};
static const char* operator_name[] =
{
"!", /*_L_NOT */
"~", /*_B_NOT */
"&", /*_B_AND */
"&~", /*_B_NAND */
"|", /*_B_OR */
"|~", /*_B_NOR */
"^", /*_B_XOR */
"^~", /*_B_EQU */
"+", /*_PLUS */
"-", /*_MINUS */
"*", /*_MUL */
"/", /*_DIV */
"%", /*_MOD */
"**", /*_POW */
"==", /*_L_EQ */
"!=", /*_L_NEQ */
"===", /*_C_EQ */
"!==", /*_C_NEQ */
"&&", /*_L_AND */
"||", /*_L_OR */
"<", /*_LT */
"<=", /*_LTE */
">", /*_GT */
">=", /*_GTE */
">>", /*_LSR */
"<<", /*_LSL */
">>>", /*_ASR */
"<<<", /*_ASL */
};
#endif
#ifdef __cplusplus
......
......@@ -125,34 +125,9 @@ static int portValid(HOBJECT object)
return 1;
}
static const char* port_direct_name[] = {
"input ",
"inout ",
"output ",
"" /* UNKOWN */
};
static const char* port_type_name[] = {
"",
"supply0",
"supply1",
"tri",
"triand",
"trior",
"tri0",
"tri1",
"uwire",
"wire",
"wand",
"wor",
"integer",
"time",
"reg",
};
static int output_port_type(FILE* pFile, int ptype)
{
fprintf(pFile, port_type_name[ptype]);
fprintf(pFile, var_type_name[ptype]);
}
static int output_range(FILE* pFile, int opt, int type, IVerilogNode **msb, IVerilogNode ** lsb)
......
......@@ -56,7 +56,6 @@ typedef struct _sVarDecl {
IVerilogNode** assignexpr;
IDListVar* attributes;
IDListVar* dimensions;
int drive_strength;
int vectored_or_scalared;
int issigned;
int range_type;
......@@ -136,11 +135,47 @@ static int vardeclValid(HOBJECT object)
return 1;
}
static int output_range(FILE* pFile, int opt, int type, IVerilogNode** msb, IVerilogNode** lsb)
{
if (type == RANGE_TYPE_NONE)
return 0;
if (type == RANGE_TYPE_BITSELECT) {
fprintf(pFile, " [");
objectCall2(msb, dump, pFile, opt);
fprintf(pFile, "] ");
return 0;
}
fprintf(pFile, " [");
objectCall2(msb, dump, pFile, opt);
if (type == RANGE_TYPE_PARTSELECT)
fprintf(pFile, ":");
else if (type == RANGE_TYPE_STARTPLUSWIDTH)
fprintf(pFile, "+:");
else if (type == RANGE_TYPE_STARTMINUSWIDTH)
fprintf(pFile, "-:");
objectCall2(lsb, dump, pFile, opt);
fprintf(pFile, "] ");
return 0;
}
static int vardecl_verilognode_dump(HOBJECT object, FILE * pFile, int opt)
{
sVarDecl * pobj;
pobj = (sVarDecl *)objectThis(object);
fprintf(pFile, "%s", pobj->name);
/*
attribute_instance_list net_type drive_strength_option vectored_or_scalared_option signed_option
range_option delay3_option list_of_net
*/
fprintf(pFile, " ");
if (dlistItemCount(pobj->attributes) > 0) {
fprintf(pFile, "(* ");
verilog_dump_node_list(pobj->attributes, pFile, opt, ", ");
fprintf(pFile, " *) ");
}
fprintf(pFile, var_type_name[pobj->type]);
output_range(pFile, opt, pobj->range_type, pobj->range_msb, pobj->range_lsb);
fprintf(pFile, " %s", pobj->name);
if (pobj->assignexpr != NULL) {
fprintf(pFile, " = ");
objectCall2(pobj->assignexpr, dump, pFile, opt);
......@@ -187,7 +222,6 @@ int verilogparseVarDeclSetDimensions(HOBJECT object, IDListVar* dimensions)
int verilogparseVarDeclSetOptions(HOBJECT object,
int type,
IDListVar* attributes,
int drive_strength,
int vectored_or_scalared,
int issigned,
int range_type,
......@@ -209,7 +243,6 @@ int verilogparseVarDeclSetOptions(HOBJECT object,
pobj = (sVarDecl*)objectThis(object);
pobj->attributes = attributes;
objectAddRef(pobj->attributes);
pobj->drive_strength = drive_strength;
pobj->type = type;
pobj->vectored_or_scalared = vectored_or_scalared;
pobj->issigned = issigned;
......
......@@ -48,14 +48,12 @@ extern "C" {
DEFINE_GUID(CLSID_VERILOG_VARDECL, 0x71990979, 0xc02a, 0x44af, 0xa2, 0x49, 0xd7, 0x2, 0xec, 0x6d, 0x7a, 0x4d);
HOBJECT verilogparseCreateVarDecl(const char * name);
int verilogparseVarDeclSetAssignExpr(HOBJECT object, HOBJECT expr);
int verilogparseVarDeclSetDimensions(HOBJECT object, IDListVar * dimensions);
int verilogparseVarDeclSetOptions(HOBJECT object,
int type,
IDListVar* attributes,
int drive_strength,
int vectored_or_scalared,
int issigned,
int range_type,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册