/* ** HDL4SE: 软件Verilog综合仿真平台 ** Copyright (C) 2021-2021, raoxianhong ** LCOM: 轻量级组件对象模型 ** Copyright (C) 2021-2021, raoxianhong ** 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 statementESS 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_statement.c 修改记录: 202107010615: rxh, initial version */ #include "stdio.h" #include "stdlib.h" #include "string.h" #include "object.h" #include "dlist.h" #include "bignumber.h" #include "conststring.h" #include "verilog_parsetree.h" #include "verilog_varsel.h" #include "verilog_expr.h" #include "verilog_assignment.h" #define IMPLEMENT_GUID #include "verilog_statement.h" #undef IMPLEMENT_GUID typedef struct _sAssignment { OBJECT_HEADER INTERFACE_DECLARE(IVerilogNode) VERILOGNODE_VARDECLARE DLIST_VARDECLARE verilog_Statement data; }sStatement; OBJECT_FUNCDECLARE(statement, CLSID_VERILOG_STATEMENT); VERILOGNODE_FUNCDECLARE(statement, CLSID_VERILOG_STATEMENT, sStatement); DLIST_FUNCIMPL(statement, CLSID_VERILOG_STATEMENT, sStatement); OBJECT_FUNCIMPL(statement, sStatement, CLSID_VERILOG_STATEMENT); QUERYINTERFACE_BEGIN(statement, CLSID_VERILOG_STATEMENT) QUERYINTERFACE_ITEM(IID_VERILOG_NODE, IVerilogNode, sStatement) QUERYINTERFACE_ITEM(IID_DLIST, IDList, sStatement) QUERYINTERFACE_END static const char *statementModuleInfo() { return "1.0.0-20210701.0615 Statement "; } static int statementCreate(const PARAMITEM * pParams, int paramcount, HOBJECT * pObject) { sStatement * pobj; pobj = (sStatement *)malloc(sizeof(sStatement)); if (pobj == NULL) return -1; memset(pobj, 0, sizeof(sStatement)); *pObject = 0; DLIST_VARINIT(pobj, statement); VERILOGNODE_VARINIT(pobj, CLSID_VERILOG_STATEMENT); INTERFACE_INIT(IVerilogNode, pobj, statement, verilognode); /*返回生成的对象*/ OBJECT_RETURN_GEN(statement, pobj, pObject, CLSID_VERILOG_STATEMENT); return EIID_OK; } static void statementDestroy(HOBJECT object) { sStatement * pobj; pobj = (sStatement *)objectThis(object); free(pobj); } /* 功能:判断对象是否是一个有效对象 参数: object -- 对象数据指针 返回值: 0 -- 对象是无效的 1 -- 对象是有效的 */ static int statementValid(HOBJECT object) { return 1; } static int output_attributes(FILE* pFile, int opt, sStatement* pobj) { return 0; } static int statement_verilognode_dump(HOBJECT object, FILE * pFile, int opt) { sStatement * pobj; pobj = (sStatement *)objectThis(object); return 0; } static int statement_verilognode_procheck(HOBJECT object, HOBJECT module, void * param) { sStatement* pobj; pobj = (sStatement*)objectThis(object); return 0; } static int statement_verilognode_gencode(HOBJECT object, FILE * pFile, HOBJECT module, void * param) { return 0; } HOBJECT verilogparseCreateAssignmentStatement( int timecontrol, int statementtype, HOBJECT assignment ) { HOBJECT statement = NULL; sStatement * pobj; A_u_t_o_registor_statement(); objectCreate(CLSID_VERILOG_STATEMENT, NULL, 0, &statement); if (statement == NULL) return NULL; pobj = (sStatement *)objectThis(statement); pobj->data.timecontrol = timecontrol; pobj->data.statementtype = statementtype; objectQueryInterface(assignment, IID_VERILOG_NODE, (void**)&pobj->data.assignment); objectRelease(assignment); return statement; } verilog_Statement* verilogStatementGetData(HOBJECT object) { sStatement* pobj; if (!objectIsClass(object, CLSID_VERILOG_STATEMENT)) return NULL; pobj = (sStatement*)objectThis(object); return &pobj->data; }