Some cppcheck cleanup for vhdlpp
This commit is contained in:
parent
4f31fec5c8
commit
95ffc97f5f
|
|
@ -1,3 +1,5 @@
|
||||||
|
// For now skip using STL algorithms
|
||||||
|
useStlAlgorithm
|
||||||
// Skip all messages about missing system include files
|
// Skip all messages about missing system include files
|
||||||
missingIncludeSystem
|
missingIncludeSystem
|
||||||
// Skip the active checker report message
|
// Skip the active checker report message
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ cppcheck: $(O:.o=.cc)
|
||||||
cppcheck --enable=all --std=c99 --std=c++11 -f \
|
cppcheck --enable=all --std=c99 --std=c++11 -f \
|
||||||
--check-level=exhaustive \
|
--check-level=exhaustive \
|
||||||
--suppressions-list=$(srcdir)/../cppcheck-global.sup \
|
--suppressions-list=$(srcdir)/../cppcheck-global.sup \
|
||||||
|
--suppressions-list=$(srcdir)/cppcheck.sup \
|
||||||
-UYY_USER_INIT \
|
-UYY_USER_INIT \
|
||||||
-UYYPARSE_PARAM -UYYPRINT -Ushort -Usize_t -Uyyoverflow \
|
-UYYPARSE_PARAM -UYYPRINT -Ushort -Usize_t -Uyyoverflow \
|
||||||
-UYYTYPE_INT8 -UYYTYPE_INT16 -UYYTYPE_UINT8 -UYYTYPE_UINT16 \
|
-UYYTYPE_INT8 -UYYTYPE_INT16 -UYYTYPE_UINT8 -UYYTYPE_UINT16 \
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -52,7 +52,7 @@ bool Architecture::find_constant(perm_string by_name, const VType*&typ, Expressi
|
||||||
c = old_components_.find(cur_component_->component_name());
|
c = old_components_.find(cur_component_->component_name());
|
||||||
|
|
||||||
assert(c != old_components_.end());
|
assert(c != old_components_.end());
|
||||||
ComponentBase*base = c->second;
|
const ComponentBase*base = c->second;
|
||||||
|
|
||||||
const InterfacePort*generic = base->find_generic(by_name);
|
const InterfacePort*generic = base->find_generic(by_name);
|
||||||
if(!generic)
|
if(!generic)
|
||||||
|
|
@ -209,7 +209,7 @@ ComponentInstantiation::ComponentInstantiation(perm_string i, perm_string c,
|
||||||
typedef pair<map<perm_string,Expression*>::iterator,bool> insert_rc;
|
typedef pair<map<perm_string,Expression*>::iterator,bool> insert_rc;
|
||||||
|
|
||||||
while (parms && ! parms->empty()) {
|
while (parms && ! parms->empty()) {
|
||||||
named_expr_t*cur = parms->front();
|
const named_expr_t*cur = parms->front();
|
||||||
parms->pop_front();
|
parms->pop_front();
|
||||||
insert_rc rc = generic_map_.insert(make_pair(cur->name(), cur->expr()));
|
insert_rc rc = generic_map_.insert(make_pair(cur->name(), cur->expr()));
|
||||||
if (! rc.second) {
|
if (! rc.second) {
|
||||||
|
|
@ -220,7 +220,7 @@ ComponentInstantiation::ComponentInstantiation(perm_string i, perm_string c,
|
||||||
}
|
}
|
||||||
|
|
||||||
while (ports && ! ports->empty()) {
|
while (ports && ! ports->empty()) {
|
||||||
named_expr_t*cur = ports->front();
|
const named_expr_t*cur = ports->front();
|
||||||
ports->pop_front();
|
ports->pop_front();
|
||||||
insert_rc rc = port_map_.insert(make_pair(cur->name(), cur->expr()));
|
insert_rc rc = port_map_.insert(make_pair(cur->name(), cur->expr()));
|
||||||
if (! rc.second) {
|
if (! rc.second) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef IVL_architec_H
|
#ifndef IVL_architec_H
|
||||||
#define IVL_architec_H
|
#define IVL_architec_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2021 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -50,7 +50,7 @@ class Architecture : public Scope, public LineInfo {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Statement();
|
Statement();
|
||||||
virtual ~Statement() =0;
|
virtual ~Statement() override =0;
|
||||||
|
|
||||||
virtual int elaborate(Entity*ent, Architecture*arc);
|
virtual int elaborate(Entity*ent, Architecture*arc);
|
||||||
virtual int emit(std::ostream&out, Entity*ent, Architecture*arc);
|
virtual int emit(std::ostream&out, Entity*ent, Architecture*arc);
|
||||||
|
|
@ -62,12 +62,12 @@ class Architecture : public Scope, public LineInfo {
|
||||||
// NOTE: The statement list passed in is emptied.
|
// NOTE: The statement list passed in is emptied.
|
||||||
Architecture(perm_string name, const ActiveScope&ref,
|
Architecture(perm_string name, const ActiveScope&ref,
|
||||||
std::list<Architecture::Statement*>&s);
|
std::list<Architecture::Statement*>&s);
|
||||||
~Architecture();
|
~Architecture() override;
|
||||||
|
|
||||||
perm_string get_name() const { return name_; }
|
perm_string get_name() const { return name_; }
|
||||||
|
|
||||||
bool find_constant(perm_string by_name, const VType*&typ, Expression*&exp) const;
|
bool find_constant(perm_string by_name, const VType*&typ, Expression*&exp) const override;
|
||||||
Variable* find_variable(perm_string by_name) const;
|
Variable* find_variable(perm_string by_name) const override;
|
||||||
|
|
||||||
// Sets the currently processed component (to be able to reach its parameters).
|
// Sets the currently processed component (to be able to reach its parameters).
|
||||||
void set_cur_component(ComponentInstantiation*component) {
|
void set_cur_component(ComponentInstantiation*component) {
|
||||||
|
|
@ -137,7 +137,7 @@ class GenerateStatement : public Architecture::Statement {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GenerateStatement(perm_string gname, std::list<Architecture::Statement*>&s);
|
GenerateStatement(perm_string gname, std::list<Architecture::Statement*>&s);
|
||||||
~GenerateStatement();
|
~GenerateStatement() override;
|
||||||
|
|
||||||
inline perm_string get_name() const { return name_; }
|
inline perm_string get_name() const { return name_; }
|
||||||
|
|
||||||
|
|
@ -156,10 +156,10 @@ class ForGenerate : public GenerateStatement {
|
||||||
public:
|
public:
|
||||||
ForGenerate(perm_string gname, perm_string genvar,
|
ForGenerate(perm_string gname, perm_string genvar,
|
||||||
ExpRange*rang, std::list<Architecture::Statement*>&s);
|
ExpRange*rang, std::list<Architecture::Statement*>&s);
|
||||||
~ForGenerate();
|
~ForGenerate() override;
|
||||||
|
|
||||||
int elaborate(Entity*ent, Architecture*arc);
|
int elaborate(Entity*ent, Architecture*arc) override;
|
||||||
int emit(std::ostream&out, Entity*entity, Architecture*arc);
|
int emit(std::ostream&out, Entity*entity, Architecture*arc) override;
|
||||||
void dump(std::ostream&out, int ident =0) const;
|
void dump(std::ostream&out, int ident =0) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -173,10 +173,10 @@ class IfGenerate : public GenerateStatement {
|
||||||
public:
|
public:
|
||||||
IfGenerate(perm_string gname, Expression*cond,
|
IfGenerate(perm_string gname, Expression*cond,
|
||||||
std::list<Architecture::Statement*>&s);
|
std::list<Architecture::Statement*>&s);
|
||||||
~IfGenerate();
|
~IfGenerate() override;
|
||||||
|
|
||||||
int elaborate(Entity*ent, Architecture*arc);
|
int elaborate(Entity*ent, Architecture*arc) override;
|
||||||
int emit(std::ostream&out, Entity*entity, Architecture*arc);
|
int emit(std::ostream&out, Entity*entity, Architecture*arc) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Expression*cond_;
|
Expression*cond_;
|
||||||
|
|
@ -191,10 +191,10 @@ class SignalAssignment : public Architecture::Statement {
|
||||||
public:
|
public:
|
||||||
SignalAssignment(ExpName*target, std::list<Expression*>&rval);
|
SignalAssignment(ExpName*target, std::list<Expression*>&rval);
|
||||||
SignalAssignment(ExpName*target, Expression*rval);
|
SignalAssignment(ExpName*target, Expression*rval);
|
||||||
~SignalAssignment();
|
~SignalAssignment() override;
|
||||||
|
|
||||||
virtual int elaborate(Entity*ent, Architecture*arc);
|
virtual int elaborate(Entity*ent, Architecture*arc) override;
|
||||||
virtual int emit(std::ostream&out, Entity*entity, Architecture*arc);
|
virtual int emit(std::ostream&out, Entity*entity, Architecture*arc) override;
|
||||||
virtual void dump(std::ostream&out, int ident =0) const;
|
virtual void dump(std::ostream&out, int ident =0) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -206,10 +206,10 @@ class CondSignalAssignment : public Architecture::Statement {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CondSignalAssignment(ExpName*target, std::list<ExpConditional::case_t*>&options);
|
CondSignalAssignment(ExpName*target, std::list<ExpConditional::case_t*>&options);
|
||||||
~CondSignalAssignment();
|
~CondSignalAssignment() override;
|
||||||
|
|
||||||
int elaborate(Entity*ent, Architecture*arc);
|
int elaborate(Entity*ent, Architecture*arc) override;
|
||||||
int emit(std::ostream&out, Entity*entity, Architecture*arc);
|
int emit(std::ostream&out, Entity*entity, Architecture*arc) override;
|
||||||
void dump(std::ostream&out, int ident =0) const;
|
void dump(std::ostream&out, int ident =0) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -227,11 +227,11 @@ class ComponentInstantiation : public Architecture::Statement {
|
||||||
ComponentInstantiation(perm_string iname, perm_string cname,
|
ComponentInstantiation(perm_string iname, perm_string cname,
|
||||||
std::list<named_expr_t*>*parms,
|
std::list<named_expr_t*>*parms,
|
||||||
std::list<named_expr_t*>*ports);
|
std::list<named_expr_t*>*ports);
|
||||||
~ComponentInstantiation();
|
~ComponentInstantiation() override;
|
||||||
|
|
||||||
virtual int elaborate(Entity*ent, Architecture*arc);
|
virtual int elaborate(Entity*ent, Architecture*arc) override;
|
||||||
virtual int emit(std::ostream&out, Entity*entity, Architecture*arc);
|
virtual int emit(std::ostream&out, Entity*entity, Architecture*arc) override;
|
||||||
virtual void dump(std::ostream&out, int indent =0) const;
|
virtual void dump(std::ostream&out, int indent =0) const override;
|
||||||
|
|
||||||
// Returns the expression that initializes a generic (or NULL if not found).
|
// Returns the expression that initializes a generic (or NULL if not found).
|
||||||
Expression*find_generic_map(perm_string by_name) const;
|
Expression*find_generic_map(perm_string by_name) const;
|
||||||
|
|
@ -250,19 +250,19 @@ class ComponentInstantiation : public Architecture::Statement {
|
||||||
class StatementList : public Architecture::Statement {
|
class StatementList : public Architecture::Statement {
|
||||||
public:
|
public:
|
||||||
explicit StatementList(std::list<SequentialStmt*>*statement_list);
|
explicit StatementList(std::list<SequentialStmt*>*statement_list);
|
||||||
virtual ~StatementList();
|
virtual ~StatementList() override;
|
||||||
|
|
||||||
int elaborate(Entity*ent, Architecture*arc) {
|
int elaborate(Entity*ent, Architecture*arc) override {
|
||||||
return elaborate(ent, static_cast<ScopeBase*>(arc));
|
return elaborate(ent, static_cast<ScopeBase*>(arc));
|
||||||
}
|
}
|
||||||
|
|
||||||
int emit(std::ostream&out, Entity*ent, Architecture*arc) {
|
int emit(std::ostream&out, Entity*ent, Architecture*arc) override {
|
||||||
return emit(out, ent, static_cast<ScopeBase*>(arc));
|
return emit(out, ent, static_cast<ScopeBase*>(arc));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int elaborate(Entity*ent, ScopeBase*scope);
|
virtual int elaborate(Entity*ent, ScopeBase*scope);
|
||||||
virtual int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
|
virtual int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
|
||||||
virtual void dump(std::ostream&out, int indent =0) const;
|
virtual void dump(std::ostream&out, int indent =0) const override;
|
||||||
|
|
||||||
std::list<SequentialStmt*>& stmt_list() { return statements_; }
|
std::list<SequentialStmt*>& stmt_list() { return statements_; }
|
||||||
|
|
||||||
|
|
@ -277,8 +277,8 @@ class InitialStatement : public StatementList {
|
||||||
explicit InitialStatement(std::list<SequentialStmt*>*statement_list)
|
explicit InitialStatement(std::list<SequentialStmt*>*statement_list)
|
||||||
: StatementList(statement_list) {}
|
: StatementList(statement_list) {}
|
||||||
|
|
||||||
int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
|
||||||
void dump(std::ostream&out, int indent =0) const;
|
void dump(std::ostream&out, int indent =0) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// There is no direct VHDL counterpart to SV 'final' statement,
|
// There is no direct VHDL counterpart to SV 'final' statement,
|
||||||
|
|
@ -288,8 +288,8 @@ class FinalStatement : public StatementList {
|
||||||
explicit FinalStatement(std::list<SequentialStmt*>*statement_list)
|
explicit FinalStatement(std::list<SequentialStmt*>*statement_list)
|
||||||
: StatementList(statement_list) {}
|
: StatementList(statement_list) {}
|
||||||
|
|
||||||
int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
|
||||||
void dump(std::ostream&out, int indent =0) const;
|
void dump(std::ostream&out, int indent =0) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ProcessStatement : public StatementList, public Scope {
|
class ProcessStatement : public StatementList, public Scope {
|
||||||
|
|
@ -299,11 +299,11 @@ class ProcessStatement : public StatementList, public Scope {
|
||||||
const ActiveScope&ref,
|
const ActiveScope&ref,
|
||||||
std::list<Expression*>*sensitivity_list,
|
std::list<Expression*>*sensitivity_list,
|
||||||
std::list<SequentialStmt*>*statement_list);
|
std::list<SequentialStmt*>*statement_list);
|
||||||
~ProcessStatement();
|
~ProcessStatement() override;
|
||||||
|
|
||||||
int elaborate(Entity*ent, Architecture*arc);
|
int elaborate(Entity*ent, Architecture*arc) override;
|
||||||
int emit(std::ostream&out, Entity*entity, Architecture*arc);
|
int emit(std::ostream&out, Entity*entity, Architecture*arc) override;
|
||||||
void dump(std::ostream&out, int indent =0) const;
|
void dump(std::ostream&out, int indent =0) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
perm_string iname_;
|
perm_string iname_;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2021 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -105,7 +105,7 @@ int ComponentInstantiation::elaborate(Entity*ent, Architecture*arc)
|
||||||
{
|
{
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
|
|
||||||
ComponentBase*base = arc->find_component(cname_);
|
const ComponentBase*base = arc->find_component(cname_);
|
||||||
if (base == 0) {
|
if (base == 0) {
|
||||||
cerr << get_fileline() << ": error: No component declaration"
|
cerr << get_fileline() << ": error: No component declaration"
|
||||||
<< " for instance " << iname_
|
<< " for instance " << iname_
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
// Errors/limitations in the generated yacc and lex files
|
||||||
|
cstyleCast:lexor.cc
|
||||||
|
constVariablePointer:lexor.cc
|
||||||
|
duplicateBreak:lexor.lex
|
||||||
|
unusedFunction:lexor.cc
|
||||||
|
unusedStructMember:lexor.cc
|
||||||
|
constParameterPointer:parse.cc
|
||||||
|
syntaxError:parse.cc
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef IVL_entity_H
|
#ifndef IVL_entity_H
|
||||||
#define IVL_entity_H
|
#define IVL_entity_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2021 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -69,7 +69,7 @@ class ComponentBase : public LineInfo {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ComponentBase(perm_string name);
|
explicit ComponentBase(perm_string name);
|
||||||
~ComponentBase();
|
~ComponentBase() override;
|
||||||
|
|
||||||
// Entities have names.
|
// Entities have names.
|
||||||
perm_string get_name() const { return name_; }
|
perm_string get_name() const { return name_; }
|
||||||
|
|
@ -106,7 +106,7 @@ class Entity : public ComponentBase {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Entity(perm_string name);
|
explicit Entity(perm_string name);
|
||||||
~Entity();
|
~Entity() override;
|
||||||
|
|
||||||
// bind an architecture to the entity, and return the
|
// bind an architecture to the entity, and return the
|
||||||
// Architecture that was bound. If there was a previous
|
// Architecture that was bound. If there was a previous
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class Expression : public LineInfo {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Expression();
|
Expression();
|
||||||
virtual ~Expression() =0;
|
virtual ~Expression() override =0;
|
||||||
|
|
||||||
// Returns a deep copy of the expression.
|
// Returns a deep copy of the expression.
|
||||||
virtual Expression*clone() const =0;
|
virtual Expression*clone() const =0;
|
||||||
|
|
@ -184,14 +184,14 @@ class ExpUnary : public Expression {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ExpUnary(Expression*op1);
|
explicit ExpUnary(Expression*op1);
|
||||||
virtual ~ExpUnary() =0;
|
virtual ~ExpUnary() override =0;
|
||||||
|
|
||||||
inline const Expression*peek_operand() const { return operand1_; }
|
inline const Expression*peek_operand() const { return operand1_; }
|
||||||
|
|
||||||
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const;
|
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const override;
|
||||||
const VType*probe_type(Entity*ent, ScopeBase*scope) const;
|
const VType*probe_type(Entity*ent, ScopeBase*scope) const override;
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void visit(ExprVisitor& func);
|
void visit(ExprVisitor& func) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
inline void write_to_stream_operand1(std::ostream&fd) const
|
inline void write_to_stream_operand1(std::ostream&fd) const
|
||||||
|
|
@ -212,13 +212,13 @@ class ExpBinary : public Expression {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExpBinary(Expression*op1, Expression*op2);
|
ExpBinary(Expression*op1, Expression*op2);
|
||||||
virtual ~ExpBinary() =0;
|
virtual ~ExpBinary() override =0;
|
||||||
|
|
||||||
inline const Expression* peek_operand1(void) const { return operand1_; }
|
inline const Expression* peek_operand1(void) const { return operand1_; }
|
||||||
inline const Expression* peek_operand2(void) const { return operand2_; }
|
inline const Expression* peek_operand2(void) const { return operand2_; }
|
||||||
|
|
||||||
const VType*probe_type(Entity*ent, ScopeBase*scope) const;
|
const VType*probe_type(Entity*ent, ScopeBase*scope) const override;
|
||||||
void visit(ExprVisitor& func);
|
void visit(ExprVisitor& func) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
@ -326,16 +326,16 @@ class ExpAggregate : public Expression {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ExpAggregate(std::list<element_t*>*el);
|
explicit ExpAggregate(std::list<element_t*>*el);
|
||||||
~ExpAggregate();
|
~ExpAggregate() override;
|
||||||
|
|
||||||
Expression*clone() const;
|
Expression*clone() const override;
|
||||||
|
|
||||||
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const;
|
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const override;
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
void visit(ExprVisitor& func);
|
void visit(ExprVisitor& func) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int elaborate_expr_array_(Entity*ent, ScopeBase*scope, const VTypeArray*ltype);
|
int elaborate_expr_array_(Entity*ent, ScopeBase*scope, const VTypeArray*ltype);
|
||||||
|
|
@ -359,20 +359,20 @@ class ExpArithmetic : public ExpBinary {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExpArithmetic(ExpArithmetic::fun_t op, Expression*op1, Expression*op2);
|
ExpArithmetic(ExpArithmetic::fun_t op, Expression*op1, Expression*op2);
|
||||||
~ExpArithmetic();
|
~ExpArithmetic() override;
|
||||||
|
|
||||||
Expression*clone() const {
|
Expression*clone() const override {
|
||||||
return new ExpArithmetic(fun_, peek_operand1()->clone(), peek_operand2()->clone());
|
return new ExpArithmetic(fun_, peek_operand1()->clone(), peek_operand2()->clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
virtual bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const;
|
virtual bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const VType* resolve_operand_types_(const VType*t1, const VType*t2) const;
|
const VType* resolve_operand_types_(const VType*t1, const VType*t2) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
fun_t fun_;
|
fun_t fun_;
|
||||||
|
|
@ -382,7 +382,7 @@ class ExpAttribute : public Expression {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExpAttribute(perm_string name,std::list<Expression*>*args);
|
ExpAttribute(perm_string name,std::list<Expression*>*args);
|
||||||
virtual ~ExpAttribute();
|
virtual ~ExpAttribute() override;
|
||||||
|
|
||||||
inline perm_string peek_attribute() const { return name_; }
|
inline perm_string peek_attribute() const { return name_; }
|
||||||
|
|
||||||
|
|
@ -405,20 +405,20 @@ class ExpAttribute : public Expression {
|
||||||
class ExpObjAttribute : public ExpAttribute {
|
class ExpObjAttribute : public ExpAttribute {
|
||||||
public:
|
public:
|
||||||
ExpObjAttribute(ExpName*base, perm_string name, std::list<Expression*>*args);
|
ExpObjAttribute(ExpName*base, perm_string name, std::list<Expression*>*args);
|
||||||
~ExpObjAttribute();
|
~ExpObjAttribute() override;
|
||||||
|
|
||||||
Expression*clone() const;
|
Expression*clone() const override;
|
||||||
|
|
||||||
inline const ExpName* peek_base() const { return base_; }
|
inline const ExpName* peek_base() const { return base_; }
|
||||||
|
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
const VType*probe_type(Entity*ent, ScopeBase*scope) const;
|
const VType*probe_type(Entity*ent, ScopeBase*scope) const override;
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
// Some attributes can be evaluated at compile time
|
// Some attributes can be evaluated at compile time
|
||||||
bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const;
|
bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
void visit(ExprVisitor& func);
|
void visit(ExprVisitor& func) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ExpName*base_;
|
ExpName*base_;
|
||||||
|
|
@ -429,19 +429,19 @@ class ExpTypeAttribute : public ExpAttribute {
|
||||||
ExpTypeAttribute(const VType*base, perm_string name, std::list<Expression*>*args);
|
ExpTypeAttribute(const VType*base, perm_string name, std::list<Expression*>*args);
|
||||||
// no destructor - VType objects (base_) are shared between many expressions
|
// no destructor - VType objects (base_) are shared between many expressions
|
||||||
|
|
||||||
Expression*clone() const;
|
Expression*clone() const override;
|
||||||
|
|
||||||
inline const VType* peek_base() const { return base_; }
|
inline const VType* peek_base() const { return base_; }
|
||||||
|
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
const VType*probe_type(Entity*ent, ScopeBase*scope) const;
|
const VType*probe_type(Entity*ent, ScopeBase*scope) const override;
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
// Some attributes can be evaluated at compile time
|
// Some attributes can be evaluated at compile time
|
||||||
bool evaluate(ScopeBase*scope, int64_t&val) const;
|
bool evaluate(ScopeBase*scope, int64_t&val) const;
|
||||||
bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const;
|
bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
void visit(ExprVisitor& func);
|
void visit(ExprVisitor& func) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const VType*base_;
|
const VType*base_;
|
||||||
|
|
@ -452,15 +452,15 @@ class ExpBitstring : public Expression {
|
||||||
public:
|
public:
|
||||||
explicit ExpBitstring(const char*);
|
explicit ExpBitstring(const char*);
|
||||||
ExpBitstring(const ExpBitstring&other) : Expression() { value_ = other.value_; }
|
ExpBitstring(const ExpBitstring&other) : Expression() { value_ = other.value_; }
|
||||||
~ExpBitstring();
|
~ExpBitstring() override;
|
||||||
|
|
||||||
Expression*clone() const { return new ExpBitstring(*this); }
|
Expression*clone() const override { return new ExpBitstring(*this); }
|
||||||
|
|
||||||
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const;
|
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const override;
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<char>value_;
|
std::vector<char>value_;
|
||||||
|
|
@ -472,16 +472,16 @@ class ExpCharacter : public Expression {
|
||||||
public:
|
public:
|
||||||
explicit ExpCharacter(char val);
|
explicit ExpCharacter(char val);
|
||||||
ExpCharacter(const ExpCharacter&other) : Expression() { value_ = other.value_; }
|
ExpCharacter(const ExpCharacter&other) : Expression() { value_ = other.value_; }
|
||||||
~ExpCharacter();
|
~ExpCharacter() override;
|
||||||
|
|
||||||
Expression*clone() const { return new ExpCharacter(*this); }
|
Expression*clone() const override { return new ExpCharacter(*this); }
|
||||||
|
|
||||||
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const;
|
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const override;
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
bool is_primary(void) const;
|
bool is_primary(void) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
|
|
||||||
char value() const { return value_; }
|
char value() const { return value_; }
|
||||||
|
|
||||||
|
|
@ -497,20 +497,20 @@ class ExpConcat : public Expression {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExpConcat(Expression*op1, Expression*op2);
|
ExpConcat(Expression*op1, Expression*op2);
|
||||||
~ExpConcat();
|
~ExpConcat() override;
|
||||||
|
|
||||||
Expression*clone() const {
|
Expression*clone() const override {
|
||||||
return new ExpConcat(operand1_->clone(), operand2_->clone());
|
return new ExpConcat(operand1_->clone(), operand2_->clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
const VType*probe_type(Entity*ent, ScopeBase*scope) const;
|
const VType*probe_type(Entity*ent, ScopeBase*scope) const override;
|
||||||
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const;
|
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const override;
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
bool is_primary(void) const;
|
bool is_primary(void) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
void visit(ExprVisitor& func);
|
void visit(ExprVisitor& func) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int elaborate_expr_array_(Entity*ent, ScopeBase*scope, const VTypeArray*ltype);
|
int elaborate_expr_array_(Entity*ent, ScopeBase*scope, const VTypeArray*ltype);
|
||||||
|
|
@ -553,16 +553,16 @@ class ExpConditional : public Expression {
|
||||||
public:
|
public:
|
||||||
ExpConditional(Expression*cond, std::list<Expression*>*tru,
|
ExpConditional(Expression*cond, std::list<Expression*>*tru,
|
||||||
std::list<case_t*>*options);
|
std::list<case_t*>*options);
|
||||||
virtual ~ExpConditional();
|
virtual ~ExpConditional() override;
|
||||||
|
|
||||||
virtual Expression*clone() const;
|
virtual Expression*clone() const override;
|
||||||
|
|
||||||
const VType*probe_type(Entity*ent, ScopeBase*scope) const;
|
const VType*probe_type(Entity*ent, ScopeBase*scope) const override;
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
void visit(ExprVisitor& func);
|
void visit(ExprVisitor& func) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::list<case_t*> options_;
|
std::list<case_t*> options_;
|
||||||
|
|
@ -574,9 +574,9 @@ class ExpConditional : public Expression {
|
||||||
class ExpSelected : public ExpConditional {
|
class ExpSelected : public ExpConditional {
|
||||||
public:
|
public:
|
||||||
ExpSelected(Expression*selector, std::list<case_t*>*options);
|
ExpSelected(Expression*selector, std::list<case_t*>*options);
|
||||||
~ExpSelected();
|
~ExpSelected() override;
|
||||||
|
|
||||||
Expression*clone() const;
|
Expression*clone() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Expression*selector_;
|
Expression*selector_;
|
||||||
|
|
@ -593,15 +593,15 @@ class ExpEdge : public ExpUnary {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ExpEdge(ExpEdge::fun_t ty, Expression*op);
|
explicit ExpEdge(ExpEdge::fun_t ty, Expression*op);
|
||||||
~ExpEdge();
|
~ExpEdge() override;
|
||||||
|
|
||||||
Expression*clone() const { return new ExpEdge(fun_, peek_operand()->clone()); }
|
Expression*clone() const override { return new ExpEdge(fun_, peek_operand()->clone()); }
|
||||||
|
|
||||||
inline fun_t edge_fun() const { return fun_; }
|
inline fun_t edge_fun() const { return fun_; }
|
||||||
|
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
fun_t fun_;
|
fun_t fun_;
|
||||||
|
|
@ -612,23 +612,23 @@ class ExpFunc : public Expression {
|
||||||
public:
|
public:
|
||||||
explicit ExpFunc(perm_string nn);
|
explicit ExpFunc(perm_string nn);
|
||||||
ExpFunc(perm_string nn, std::list<Expression*>*args);
|
ExpFunc(perm_string nn, std::list<Expression*>*args);
|
||||||
~ExpFunc();
|
~ExpFunc() override;
|
||||||
|
|
||||||
Expression*clone() const;
|
Expression*clone() const override;
|
||||||
|
|
||||||
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const;
|
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const override;
|
||||||
inline perm_string func_name() const { return name_; }
|
inline perm_string func_name() const { return name_; }
|
||||||
inline size_t func_args() const { return argv_.size(); }
|
inline size_t func_args() const { return argv_.size(); }
|
||||||
inline const Expression*func_arg(size_t idx) const { return argv_[idx]; }
|
inline const Expression*func_arg(size_t idx) const { return argv_[idx]; }
|
||||||
const VType*func_ret_type() const;
|
const VType*func_ret_type() const;
|
||||||
|
|
||||||
public: // Base methods
|
public: // Base methods
|
||||||
const VType*probe_type(Entity*ent, ScopeBase*scope) const;
|
const VType*probe_type(Entity*ent, ScopeBase*scope) const override;
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
void visit(ExprVisitor& func); // NOTE: does not handle expressions in subprogram body
|
void visit(ExprVisitor& func) override; // NOTE: does not handle expressions in subprogram body
|
||||||
|
|
||||||
// Returns a subprogram header that matches the function call
|
// Returns a subprogram header that matches the function call
|
||||||
SubprogramHeader*match_signature(Entity*ent, ScopeBase*scope) const;
|
SubprogramHeader*match_signature(Entity*ent, ScopeBase*scope) const;
|
||||||
|
|
@ -644,19 +644,19 @@ class ExpInteger : public Expression {
|
||||||
public:
|
public:
|
||||||
explicit ExpInteger(int64_t val);
|
explicit ExpInteger(int64_t val);
|
||||||
ExpInteger(const ExpInteger&other) : Expression(), value_(other.value_) {}
|
ExpInteger(const ExpInteger&other) : Expression(), value_(other.value_) {}
|
||||||
~ExpInteger();
|
~ExpInteger() override;
|
||||||
|
|
||||||
Expression*clone() const { return new ExpInteger(*this); }
|
Expression*clone() const override { return new ExpInteger(*this); }
|
||||||
|
|
||||||
const VType*probe_type(Entity*ent, ScopeBase*scope) const;
|
const VType*probe_type(Entity*ent, ScopeBase*scope) const override;
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
int emit_package(std::ostream&out) const;
|
int emit_package(std::ostream&out) const override;
|
||||||
bool is_primary(void) const { return true; }
|
bool is_primary(void) const override { return true; }
|
||||||
bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const;
|
bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
virtual std::ostream& dump_inline(std::ostream&out) const;
|
virtual std::ostream& dump_inline(std::ostream&out) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int64_t value_;
|
int64_t value_;
|
||||||
|
|
@ -667,18 +667,18 @@ class ExpReal : public Expression {
|
||||||
public:
|
public:
|
||||||
explicit ExpReal(double val);
|
explicit ExpReal(double val);
|
||||||
ExpReal(const ExpReal&other) : Expression(), value_(other.value_) {}
|
ExpReal(const ExpReal&other) : Expression(), value_(other.value_) {}
|
||||||
~ExpReal();
|
~ExpReal() override;
|
||||||
|
|
||||||
Expression*clone() const { return new ExpReal(*this); }
|
Expression*clone() const override { return new ExpReal(*this); }
|
||||||
|
|
||||||
const VType*probe_type(Entity*ent, ScopeBase*scope) const;
|
const VType*probe_type(Entity*ent, ScopeBase*scope) const override;
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
int emit_package(std::ostream&out) const;
|
int emit_package(std::ostream&out) const override;
|
||||||
bool is_primary(void) const;
|
bool is_primary(void) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
virtual std::ostream& dump_inline(std::ostream&out) const;
|
virtual std::ostream& dump_inline(std::ostream&out) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double value_;
|
double value_;
|
||||||
|
|
@ -691,18 +691,18 @@ class ExpLogical : public ExpBinary {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExpLogical(ExpLogical::fun_t ty, Expression*op1, Expression*op2);
|
ExpLogical(ExpLogical::fun_t ty, Expression*op1, Expression*op2);
|
||||||
~ExpLogical();
|
~ExpLogical() override;
|
||||||
|
|
||||||
Expression*clone() const {
|
Expression*clone() const override {
|
||||||
return new ExpLogical(fun_, peek_operand1()->clone(), peek_operand2()->clone());
|
return new ExpLogical(fun_, peek_operand1()->clone(), peek_operand2()->clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun_t logic_fun() const { return fun_; }
|
inline fun_t logic_fun() const { return fun_; }
|
||||||
|
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
fun_t fun_;
|
fun_t fun_;
|
||||||
|
|
@ -719,26 +719,26 @@ class ExpName : public Expression {
|
||||||
explicit ExpName(perm_string nn);
|
explicit ExpName(perm_string nn);
|
||||||
ExpName(perm_string nn, std::list<Expression*>*indices);
|
ExpName(perm_string nn, std::list<Expression*>*indices);
|
||||||
ExpName(ExpName*prefix, perm_string nn, std::list<Expression*>*indices = NULL);
|
ExpName(ExpName*prefix, perm_string nn, std::list<Expression*>*indices = NULL);
|
||||||
virtual ~ExpName();
|
virtual ~ExpName() override;
|
||||||
|
|
||||||
public: // Base methods
|
public: // Base methods
|
||||||
Expression*clone() const;
|
Expression*clone() const override;
|
||||||
int elaborate_lval(Entity*ent, ScopeBase*scope, bool);
|
int elaborate_lval(Entity*ent, ScopeBase*scope, bool) override;
|
||||||
int elaborate_rval(const Entity*ent, const ScopeBase*scope, const InterfacePort*);
|
int elaborate_rval(const Entity*ent, const ScopeBase*scope, const InterfacePort*);
|
||||||
const VType* probe_type(Entity*ent, ScopeBase*scope) const;
|
const VType* probe_type(Entity*ent, ScopeBase*scope) const override;
|
||||||
const VType* fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*host) const;
|
const VType* fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*host) const override;
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit_indices(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit_indices(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
bool is_primary(void) const;
|
bool is_primary(void) const override;
|
||||||
bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const;
|
bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const override;
|
||||||
bool symbolic_compare(const Expression*that) const;
|
bool symbolic_compare(const Expression*that) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
inline const char* name() const { return name_; }
|
inline const char* name() const { return name_; }
|
||||||
inline const perm_string& peek_name() const { return name_; }
|
inline const perm_string& peek_name() const { return name_; }
|
||||||
void add_index(std::list<Expression*>*idx);
|
void add_index(std::list<Expression*>*idx);
|
||||||
void visit(ExprVisitor& func);
|
void visit(ExprVisitor& func) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class index_t {
|
class index_t {
|
||||||
|
|
@ -797,8 +797,8 @@ class ExpNameALL : public ExpName {
|
||||||
ExpNameALL() : ExpName(empty_perm_string) { }
|
ExpNameALL() : ExpName(empty_perm_string) { }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const VType* probe_type(Entity*ent, ScopeBase*scope) const;
|
const VType* probe_type(Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent =0) const;
|
void dump(std::ostream&out, int indent =0) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExpRelation : public ExpBinary {
|
class ExpRelation : public ExpBinary {
|
||||||
|
|
@ -810,17 +810,17 @@ class ExpRelation : public ExpBinary {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExpRelation(ExpRelation::fun_t ty, Expression*op1, Expression*op2);
|
ExpRelation(ExpRelation::fun_t ty, Expression*op1, Expression*op2);
|
||||||
~ExpRelation();
|
~ExpRelation() override;
|
||||||
|
|
||||||
Expression*clone() const {
|
Expression*clone() const override {
|
||||||
return new ExpRelation(fun_, peek_operand1()->clone(), peek_operand2()->clone());
|
return new ExpRelation(fun_, peek_operand1()->clone(), peek_operand2()->clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
const VType* probe_type(Entity*ent, ScopeBase*scope) const;
|
const VType* probe_type(Entity*ent, ScopeBase*scope) const override;
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
fun_t fun_;
|
fun_t fun_;
|
||||||
|
|
@ -833,46 +833,46 @@ class ExpRelation : public ExpBinary {
|
||||||
class ExpScopedName : public Expression {
|
class ExpScopedName : public Expression {
|
||||||
public:
|
public:
|
||||||
ExpScopedName(perm_string scope, ExpName*exp);
|
ExpScopedName(perm_string scope, ExpName*exp);
|
||||||
~ExpScopedName();
|
~ExpScopedName() override;
|
||||||
|
|
||||||
Expression*clone() const
|
Expression*clone() const override
|
||||||
{ return new ExpScopedName(scope_name_, static_cast<ExpName*>(name_->clone())); }
|
{ return new ExpScopedName(scope_name_, static_cast<ExpName*>(name_->clone())); }
|
||||||
|
|
||||||
int elaborate_lval(Entity*ent, ScopeBase*scope, bool is_sequ)
|
int elaborate_lval(Entity*ent, ScopeBase*scope, bool is_sequ) override
|
||||||
{ return name_->elaborate_lval(ent, get_scope(scope), is_sequ); }
|
{ return name_->elaborate_lval(ent, get_scope(scope), is_sequ); }
|
||||||
|
|
||||||
int elaborate_rval(const Entity*ent, const ScopeBase*scope, const InterfacePort*lval)
|
int elaborate_rval(const Entity*ent, const ScopeBase*scope, const InterfacePort*lval)
|
||||||
{ return name_->elaborate_rval(ent, get_scope(scope), lval); }
|
{ return name_->elaborate_rval(ent, get_scope(scope), lval); }
|
||||||
|
|
||||||
const VType* probe_type(Entity*ent, ScopeBase*scope) const
|
const VType* probe_type(Entity*ent, ScopeBase*scope) const override
|
||||||
{ return name_->probe_type(ent, get_scope(scope)); }
|
{ return name_->probe_type(ent, get_scope(scope)); }
|
||||||
|
|
||||||
const VType* fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*host) const
|
const VType* fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*host) const override
|
||||||
{ return name_->fit_type(ent, get_scope(scope), host); }
|
{ return name_->fit_type(ent, get_scope(scope), host); }
|
||||||
|
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype)
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override
|
||||||
{ return name_->elaborate_expr(ent, get_scope(scope), ltype); }
|
{ return name_->elaborate_expr(ent, get_scope(scope), ltype); }
|
||||||
|
|
||||||
void write_to_stream(std::ostream&fd) const
|
void write_to_stream(std::ostream&fd) const override
|
||||||
{ name_->write_to_stream(fd); }
|
{ name_->write_to_stream(fd); }
|
||||||
|
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const {
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override {
|
||||||
out << scope_name_ << ".";
|
out << scope_name_ << ".";
|
||||||
return name_->emit(out, ent, scope);
|
return name_->emit(out, ent, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_primary(void) const
|
bool is_primary(void) const override
|
||||||
{ return name_->is_primary(); }
|
{ return name_->is_primary(); }
|
||||||
|
|
||||||
bool evaluate(Entity*ent, ScopeBase*, int64_t&val) const
|
bool evaluate(Entity*ent, ScopeBase*, int64_t&val) const override
|
||||||
{ return name_->evaluate(ent, scope_, val); }
|
{ return name_->evaluate(ent, scope_, val); }
|
||||||
|
|
||||||
bool symbolic_compare(const Expression*that) const
|
bool symbolic_compare(const Expression*that) const override
|
||||||
{ return name_->symbolic_compare(that); }
|
{ return name_->symbolic_compare(that); }
|
||||||
|
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
|
|
||||||
void visit(ExprVisitor&func);
|
void visit(ExprVisitor&func) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Functions that resolve the origin scope for the name expression
|
// Functions that resolve the origin scope for the name expression
|
||||||
|
|
@ -891,15 +891,15 @@ class ExpShift : public ExpBinary {
|
||||||
public:
|
public:
|
||||||
ExpShift(ExpShift::shift_t op, Expression*op1, Expression*op2);
|
ExpShift(ExpShift::shift_t op, Expression*op1, Expression*op2);
|
||||||
|
|
||||||
Expression*clone() const {
|
Expression*clone() const override {
|
||||||
return new ExpShift(shift_, peek_operand1()->clone(), peek_operand2()->clone());
|
return new ExpShift(shift_, peek_operand1()->clone(), peek_operand2()->clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const;
|
bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
shift_t shift_;
|
shift_t shift_;
|
||||||
|
|
@ -910,16 +910,16 @@ class ExpString : public Expression {
|
||||||
public:
|
public:
|
||||||
explicit ExpString(const char*);
|
explicit ExpString(const char*);
|
||||||
ExpString(const ExpString&other) : Expression(), value_(other.value_) {}
|
ExpString(const ExpString&other) : Expression(), value_(other.value_) {}
|
||||||
~ExpString();
|
~ExpString() override;
|
||||||
|
|
||||||
Expression*clone() const { return new ExpString(*this); }
|
Expression*clone() const override { return new ExpString(*this); }
|
||||||
|
|
||||||
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const;
|
const VType*fit_type(Entity*ent, ScopeBase*scope, const VTypeArray*atype) const override;
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
bool is_primary(void) const;
|
bool is_primary(void) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
const std::string& get_value() const { return value_; }
|
const std::string& get_value() const { return value_; }
|
||||||
|
|
||||||
// Converts quotation marks (") to its escaped
|
// Converts quotation marks (") to its escaped
|
||||||
|
|
@ -937,39 +937,39 @@ class ExpUAbs : public ExpUnary {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ExpUAbs(Expression*op1);
|
explicit ExpUAbs(Expression*op1);
|
||||||
~ExpUAbs();
|
~ExpUAbs() override;
|
||||||
|
|
||||||
Expression*clone() const { return new ExpUAbs(peek_operand()->clone()); }
|
Expression*clone() const override { return new ExpUAbs(peek_operand()->clone()); }
|
||||||
|
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExpUNot : public ExpUnary {
|
class ExpUNot : public ExpUnary {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ExpUNot(Expression*op1);
|
explicit ExpUNot(Expression*op1);
|
||||||
~ExpUNot();
|
~ExpUNot() override;
|
||||||
|
|
||||||
Expression*clone() const { return new ExpUNot(peek_operand()->clone()); }
|
Expression*clone() const override { return new ExpUNot(peek_operand()->clone()); }
|
||||||
|
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExpUMinus : public ExpUnary {
|
class ExpUMinus : public ExpUnary {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ExpUMinus(Expression*op1);
|
explicit ExpUMinus(Expression*op1);
|
||||||
~ExpUMinus();
|
~ExpUMinus() override;
|
||||||
|
|
||||||
Expression*clone() const { return new ExpUMinus(peek_operand()->clone()); }
|
Expression*clone() const override { return new ExpUMinus(peek_operand()->clone()); }
|
||||||
|
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -979,17 +979,17 @@ class ExpCast : public Expression {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExpCast(Expression*base, const VType*type);
|
ExpCast(Expression*base, const VType*type);
|
||||||
~ExpCast();
|
~ExpCast() override;
|
||||||
|
|
||||||
Expression*clone() const { return new ExpCast(base_->clone(), type_->clone()); }
|
Expression*clone() const override { return new ExpCast(base_->clone(), type_->clone()); }
|
||||||
|
|
||||||
inline int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*) {
|
inline int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*) override {
|
||||||
return base_->elaborate_expr(ent, scope, type_);
|
return base_->elaborate_expr(ent, scope, type_);
|
||||||
}
|
}
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
void visit(ExprVisitor& func);
|
void visit(ExprVisitor& func) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Expression*base_;
|
Expression*base_;
|
||||||
|
|
@ -1004,15 +1004,15 @@ class ExpNew : public Expression {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ExpNew(Expression*size);
|
explicit ExpNew(Expression*size);
|
||||||
~ExpNew();
|
~ExpNew() override;
|
||||||
|
|
||||||
Expression*clone() const { return new ExpNew(size_->clone()); }
|
Expression*clone() const override { return new ExpNew(size_->clone()); }
|
||||||
|
|
||||||
// There is no 'new' in VHDL - do not emit anything
|
// There is no 'new' in VHDL - do not emit anything
|
||||||
void write_to_stream(std::ostream&) const {};
|
void write_to_stream(std::ostream&) const override {};
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
void visit(ExprVisitor& func);
|
void visit(ExprVisitor& func) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Expression*size_;
|
Expression*size_;
|
||||||
|
|
@ -1024,13 +1024,13 @@ class ExpTime : public Expression {
|
||||||
|
|
||||||
ExpTime(uint64_t amount, timeunit_t unit);
|
ExpTime(uint64_t amount, timeunit_t unit);
|
||||||
|
|
||||||
Expression*clone() const { return new ExpTime(amount_, unit_); }
|
Expression*clone() const override { return new ExpTime(amount_, unit_); }
|
||||||
|
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&) const;
|
void write_to_stream(std::ostream&) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
//bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const;
|
//bool evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Returns the time value expressed in femtoseconds
|
// Returns the time value expressed in femtoseconds
|
||||||
|
|
@ -1047,9 +1047,9 @@ class ExpRange : public Expression {
|
||||||
ExpRange(Expression*left_idx, Expression*right_idx, range_dir_t dir);
|
ExpRange(Expression*left_idx, Expression*right_idx, range_dir_t dir);
|
||||||
// 'range/'reverse range attribute
|
// 'range/'reverse range attribute
|
||||||
ExpRange(ExpName*base, bool reverse_range);
|
ExpRange(ExpName*base, bool reverse_range);
|
||||||
~ExpRange();
|
~ExpRange() override;
|
||||||
|
|
||||||
Expression*clone() const;
|
Expression*clone() const override;
|
||||||
|
|
||||||
// Returns the upper boundary
|
// Returns the upper boundary
|
||||||
Expression*msb();
|
Expression*msb();
|
||||||
|
|
@ -1061,10 +1061,10 @@ class ExpRange : public Expression {
|
||||||
|
|
||||||
range_dir_t direction() const { return direction_; }
|
range_dir_t direction() const { return direction_; }
|
||||||
|
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&) const;
|
void write_to_stream(std::ostream&) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
private:
|
private:
|
||||||
// Regular range related fields
|
// Regular range related fields
|
||||||
Expression*left_, *right_;
|
Expression*left_, *right_;
|
||||||
|
|
@ -1083,15 +1083,15 @@ class ExpRange : public Expression {
|
||||||
class ExpDelay : public Expression {
|
class ExpDelay : public Expression {
|
||||||
public:
|
public:
|
||||||
ExpDelay(Expression*expr, Expression*delay);
|
ExpDelay(Expression*expr, Expression*delay);
|
||||||
~ExpDelay();
|
~ExpDelay() override;
|
||||||
|
|
||||||
Expression*clone() const { return new ExpDelay(expr_->clone(), delay_->clone()); }
|
Expression*clone() const override { return new ExpDelay(expr_->clone(), delay_->clone()); }
|
||||||
|
|
||||||
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype);
|
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
|
||||||
void write_to_stream(std::ostream&) const;
|
void write_to_stream(std::ostream&) const override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
|
||||||
void dump(std::ostream&out, int indent = 0) const;
|
void dump(std::ostream&out, int indent = 0) const override;
|
||||||
void visit(ExprVisitor& func);
|
void visit(ExprVisitor& func) override;
|
||||||
|
|
||||||
const Expression*peek_expr() const { return expr_; }
|
const Expression*peek_expr() const { return expr_; }
|
||||||
const Expression*peek_delay() const { return delay_; }
|
const Expression*peek_delay() const { return delay_; }
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2021 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
|
||||||
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
|
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
|
|
@ -51,10 +51,10 @@ int Package::elaborate()
|
||||||
|
|
||||||
for (map<perm_string,SubHeaderList>::iterator cur = cur_subprograms_.begin()
|
for (map<perm_string,SubHeaderList>::iterator cur = cur_subprograms_.begin()
|
||||||
; cur != cur_subprograms_.end() ; ++ cur) {
|
; cur != cur_subprograms_.end() ; ++ cur) {
|
||||||
SubHeaderList& subp_list = cur->second;
|
const SubHeaderList& subp_list = cur->second;
|
||||||
|
|
||||||
for(SubHeaderList::iterator it = subp_list.begin();
|
for(SubHeaderList::const_iterator it = subp_list.cbegin();
|
||||||
it != subp_list.end(); ++it) {
|
it != subp_list.cend(); ++it) {
|
||||||
(*it)->set_package(this);
|
(*it)->set_package(this);
|
||||||
errors += (*it)->elaborate();
|
errors += (*it)->elaborate();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef IVL_package_H
|
#ifndef IVL_package_H
|
||||||
#define IVL_package_H
|
#define IVL_package_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2014 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
|
||||||
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
|
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
|
|
@ -28,7 +28,7 @@ class Package : public Scope, public LineInfo {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Package(perm_string name, const ActiveScope&ref);
|
Package(perm_string name, const ActiveScope&ref);
|
||||||
~Package();
|
~Package() override;
|
||||||
|
|
||||||
// The the library from which this package came. Having a
|
// The the library from which this package came. Having a
|
||||||
// source library influences the emit_package() method.
|
// source library influences the emit_package() method.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef IVL_scope_H
|
#ifndef IVL_scope_H
|
||||||
#define IVL_scope_H
|
#define IVL_scope_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2021 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
|
||||||
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
|
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
|
|
@ -180,7 +180,7 @@ class Scope : public ScopeBase {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Scope(const ActiveScope&ref) : ScopeBase(ref) {}
|
explicit Scope(const ActiveScope&ref) : ScopeBase(ref) {}
|
||||||
virtual ~Scope() {}
|
virtual ~Scope() override {}
|
||||||
|
|
||||||
ComponentBase* find_component(perm_string by_name);
|
ComponentBase* find_component(perm_string by_name);
|
||||||
|
|
||||||
|
|
@ -202,7 +202,7 @@ class ActiveScope : public ScopeBase {
|
||||||
ActiveScope() : context_entity_(0) { }
|
ActiveScope() : context_entity_(0) { }
|
||||||
explicit ActiveScope(const ActiveScope*par);
|
explicit ActiveScope(const ActiveScope*par);
|
||||||
|
|
||||||
~ActiveScope() { }
|
~ActiveScope() override { }
|
||||||
|
|
||||||
// Pull items from "that" scope into "this" scope as is
|
// Pull items from "that" scope into "this" scope as is
|
||||||
// defined by a "use" directive. The parser uses this method
|
// defined by a "use" directive. The parser uses this method
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef IVL_sequential_H
|
#ifndef IVL_sequential_H
|
||||||
#define IVL_sequential_H
|
#define IVL_sequential_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2021 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
|
||||||
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
|
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
|
|
@ -38,7 +38,7 @@ class SequentialStmt : public LineInfo {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SequentialStmt();
|
SequentialStmt();
|
||||||
virtual ~SequentialStmt() =0;
|
virtual ~SequentialStmt() override =0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual int elaborate(Entity*ent, ScopeBase*scope);
|
virtual int elaborate(Entity*ent, ScopeBase*scope);
|
||||||
|
|
@ -57,12 +57,12 @@ class SequentialStmt : public LineInfo {
|
||||||
class LoopStatement : public SequentialStmt {
|
class LoopStatement : public SequentialStmt {
|
||||||
public:
|
public:
|
||||||
LoopStatement(perm_string block_name, std::list<SequentialStmt*>*);
|
LoopStatement(perm_string block_name, std::list<SequentialStmt*>*);
|
||||||
virtual ~LoopStatement();
|
virtual ~LoopStatement() override;
|
||||||
|
|
||||||
inline perm_string loop_name() const { return name_; }
|
inline perm_string loop_name() const { return name_; }
|
||||||
|
|
||||||
void dump(std::ostream&out, int indent) const;
|
void dump(std::ostream&out, int indent) const override;
|
||||||
void visit(SeqStmtVisitor& func);
|
void visit(SeqStmtVisitor& func) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int elaborate_substatements(Entity*ent, ScopeBase*scope);
|
int elaborate_substatements(Entity*ent, ScopeBase*scope);
|
||||||
|
|
@ -104,14 +104,14 @@ class IfSequential : public SequentialStmt {
|
||||||
IfSequential(Expression*cond, std::list<SequentialStmt*>*tr,
|
IfSequential(Expression*cond, std::list<SequentialStmt*>*tr,
|
||||||
std::list<IfSequential::Elsif*>*elsif,
|
std::list<IfSequential::Elsif*>*elsif,
|
||||||
std::list<SequentialStmt*>*fa);
|
std::list<SequentialStmt*>*fa);
|
||||||
~IfSequential();
|
~IfSequential() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int elaborate(Entity*ent, ScopeBase*scope);
|
int elaborate(Entity*ent, ScopeBase*scope) override;
|
||||||
int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
|
||||||
void write_to_stream(std::ostream&fd);
|
void write_to_stream(std::ostream&fd) override;
|
||||||
void dump(std::ostream&out, int indent) const;
|
void dump(std::ostream&out, int indent) const override;
|
||||||
void visit(SeqStmtVisitor& func);
|
void visit(SeqStmtVisitor& func) override;
|
||||||
|
|
||||||
const Expression*peek_condition() const { return cond_; }
|
const Expression*peek_condition() const { return cond_; }
|
||||||
|
|
||||||
|
|
@ -132,13 +132,13 @@ class IfSequential : public SequentialStmt {
|
||||||
class ReturnStmt : public SequentialStmt {
|
class ReturnStmt : public SequentialStmt {
|
||||||
public:
|
public:
|
||||||
explicit ReturnStmt(Expression*val);
|
explicit ReturnStmt(Expression*val);
|
||||||
~ReturnStmt();
|
~ReturnStmt() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int elaborate(Entity*ent, ScopeBase*scope);
|
int elaborate(Entity*ent, ScopeBase*scope) override;
|
||||||
int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
|
||||||
void write_to_stream(std::ostream&fd);
|
void write_to_stream(std::ostream&fd) override;
|
||||||
void dump(std::ostream&out, int indent) const;
|
void dump(std::ostream&out, int indent) const override;
|
||||||
|
|
||||||
const Expression*peek_expr() const { return val_; };
|
const Expression*peek_expr() const { return val_; };
|
||||||
void cast_to(const VType*type);
|
void cast_to(const VType*type);
|
||||||
|
|
@ -150,13 +150,13 @@ class ReturnStmt : public SequentialStmt {
|
||||||
class SignalSeqAssignment : public SequentialStmt {
|
class SignalSeqAssignment : public SequentialStmt {
|
||||||
public:
|
public:
|
||||||
SignalSeqAssignment(Expression*sig, std::list<Expression*>*wav);
|
SignalSeqAssignment(Expression*sig, std::list<Expression*>*wav);
|
||||||
~SignalSeqAssignment();
|
~SignalSeqAssignment() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int elaborate(Entity*ent, ScopeBase*scope);
|
int elaborate(Entity*ent, ScopeBase*scope) override;
|
||||||
int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
|
||||||
void write_to_stream(std::ostream&fd);
|
void write_to_stream(std::ostream&fd) override;
|
||||||
void dump(std::ostream&out, int indent) const;
|
void dump(std::ostream&out, int indent) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Expression*lval_;
|
Expression*lval_;
|
||||||
|
|
@ -186,14 +186,14 @@ class CaseSeqStmt : public SequentialStmt {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CaseSeqStmt(Expression*cond, std::list<CaseStmtAlternative*>*sp);
|
CaseSeqStmt(Expression*cond, std::list<CaseStmtAlternative*>*sp);
|
||||||
~CaseSeqStmt();
|
~CaseSeqStmt() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void dump(std::ostream&out, int indent) const;
|
void dump(std::ostream&out, int indent) const override;
|
||||||
int elaborate(Entity*ent, ScopeBase*scope);
|
int elaborate(Entity*ent, ScopeBase*scope) override;
|
||||||
int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
|
||||||
void write_to_stream(std::ostream&fd);
|
void write_to_stream(std::ostream&fd) override;
|
||||||
void visit(SeqStmtVisitor& func);
|
void visit(SeqStmtVisitor& func) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Expression* cond_;
|
Expression* cond_;
|
||||||
|
|
@ -205,11 +205,11 @@ class ProcedureCall : public SequentialStmt {
|
||||||
explicit ProcedureCall(perm_string name);
|
explicit ProcedureCall(perm_string name);
|
||||||
ProcedureCall(perm_string name, std::list<named_expr_t*>* param_list);
|
ProcedureCall(perm_string name, std::list<named_expr_t*>* param_list);
|
||||||
ProcedureCall(perm_string name, std::list<Expression*>* param_list);
|
ProcedureCall(perm_string name, std::list<Expression*>* param_list);
|
||||||
~ProcedureCall();
|
~ProcedureCall() override;
|
||||||
|
|
||||||
int elaborate(Entity*ent, ScopeBase*scope);
|
int elaborate(Entity*ent, ScopeBase*scope) override;
|
||||||
int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
|
||||||
void dump(std::ostream&out, int indent) const;
|
void dump(std::ostream&out, int indent) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
perm_string name_;
|
perm_string name_;
|
||||||
|
|
@ -220,13 +220,13 @@ class ProcedureCall : public SequentialStmt {
|
||||||
class VariableSeqAssignment : public SequentialStmt {
|
class VariableSeqAssignment : public SequentialStmt {
|
||||||
public:
|
public:
|
||||||
VariableSeqAssignment(Expression*sig, Expression*rval);
|
VariableSeqAssignment(Expression*sig, Expression*rval);
|
||||||
~VariableSeqAssignment();
|
~VariableSeqAssignment() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int elaborate(Entity*ent, ScopeBase*scope);
|
int elaborate(Entity*ent, ScopeBase*scope) override;
|
||||||
int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
|
||||||
void write_to_stream(std::ostream&fd);
|
void write_to_stream(std::ostream&fd) override;
|
||||||
void dump(std::ostream&out, int indent) const;
|
void dump(std::ostream&out, int indent) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Expression*lval_;
|
Expression*lval_;
|
||||||
|
|
@ -237,12 +237,12 @@ class WhileLoopStatement : public LoopStatement {
|
||||||
public:
|
public:
|
||||||
WhileLoopStatement(perm_string loop_name,
|
WhileLoopStatement(perm_string loop_name,
|
||||||
Expression*, std::list<SequentialStmt*>*);
|
Expression*, std::list<SequentialStmt*>*);
|
||||||
~WhileLoopStatement();
|
~WhileLoopStatement() override;
|
||||||
|
|
||||||
int elaborate(Entity*ent, ScopeBase*scope);
|
int elaborate(Entity*ent, ScopeBase*scope) override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) override;
|
||||||
void write_to_stream(std::ostream&fd);
|
void write_to_stream(std::ostream&fd) override;
|
||||||
void dump(std::ostream&out, int indent) const;
|
void dump(std::ostream&out, int indent) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Expression* cond_;
|
Expression* cond_;
|
||||||
|
|
@ -252,12 +252,12 @@ class ForLoopStatement : public LoopStatement {
|
||||||
public:
|
public:
|
||||||
ForLoopStatement(perm_string loop_name,
|
ForLoopStatement(perm_string loop_name,
|
||||||
perm_string index, ExpRange*, std::list<SequentialStmt*>*);
|
perm_string index, ExpRange*, std::list<SequentialStmt*>*);
|
||||||
~ForLoopStatement();
|
~ForLoopStatement() override;
|
||||||
|
|
||||||
int elaborate(Entity*ent, ScopeBase*scope);
|
int elaborate(Entity*ent, ScopeBase*scope) override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) override;
|
||||||
void write_to_stream(std::ostream&fd);
|
void write_to_stream(std::ostream&fd) override;
|
||||||
void dump(std::ostream&out, int indent) const;
|
void dump(std::ostream&out, int indent) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Emits for-loop which direction is determined at run-time.
|
// Emits for-loop which direction is determined at run-time.
|
||||||
|
|
@ -271,12 +271,12 @@ class ForLoopStatement : public LoopStatement {
|
||||||
class BasicLoopStatement : public LoopStatement {
|
class BasicLoopStatement : public LoopStatement {
|
||||||
public:
|
public:
|
||||||
BasicLoopStatement(perm_string lname, std::list<SequentialStmt*>*);
|
BasicLoopStatement(perm_string lname, std::list<SequentialStmt*>*);
|
||||||
~BasicLoopStatement();
|
~BasicLoopStatement() override;
|
||||||
|
|
||||||
int elaborate(Entity*ent, ScopeBase*scope);
|
int elaborate(Entity*ent, ScopeBase*scope) override;
|
||||||
int emit(std::ostream&out, Entity*ent, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) override;
|
||||||
void write_to_stream(std::ostream&fd);
|
void write_to_stream(std::ostream&fd) override;
|
||||||
void dump(std::ostream&out, int indent) const;
|
void dump(std::ostream&out, int indent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ReportStmt : public SequentialStmt {
|
class ReportStmt : public SequentialStmt {
|
||||||
|
|
@ -284,12 +284,12 @@ class ReportStmt : public SequentialStmt {
|
||||||
typedef enum { UNSPECIFIED, NOTE, WARNING, ERROR, FAILURE } severity_t;
|
typedef enum { UNSPECIFIED, NOTE, WARNING, ERROR, FAILURE } severity_t;
|
||||||
|
|
||||||
ReportStmt(Expression*message, severity_t severity);
|
ReportStmt(Expression*message, severity_t severity);
|
||||||
virtual ~ReportStmt() {}
|
virtual ~ReportStmt() override {}
|
||||||
|
|
||||||
void dump(std::ostream&out, int indent) const;
|
void dump(std::ostream&out, int indent) const override;
|
||||||
int elaborate(Entity*ent, ScopeBase*scope);
|
int elaborate(Entity*ent, ScopeBase*scope) override;
|
||||||
int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
|
||||||
void write_to_stream(std::ostream&fd);
|
void write_to_stream(std::ostream&fd) override;
|
||||||
|
|
||||||
inline Expression*message() const { return msg_; }
|
inline Expression*message() const { return msg_; }
|
||||||
inline severity_t severity() const { return severity_; }
|
inline severity_t severity() const { return severity_; }
|
||||||
|
|
@ -306,10 +306,10 @@ class AssertStmt : public ReportStmt {
|
||||||
AssertStmt(Expression*condition, Expression*message,
|
AssertStmt(Expression*condition, Expression*message,
|
||||||
ReportStmt::severity_t severity = ReportStmt::ERROR);
|
ReportStmt::severity_t severity = ReportStmt::ERROR);
|
||||||
|
|
||||||
void dump(std::ostream&out, int indent) const;
|
void dump(std::ostream&out, int indent) const override;
|
||||||
int elaborate(Entity*ent, ScopeBase*scope);
|
int elaborate(Entity*ent, ScopeBase*scope) override;
|
||||||
int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
|
||||||
void write_to_stream(std::ostream&fd);
|
void write_to_stream(std::ostream&fd) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Expression*cond_;
|
Expression*cond_;
|
||||||
|
|
@ -322,10 +322,10 @@ class WaitForStmt : public SequentialStmt {
|
||||||
public:
|
public:
|
||||||
explicit WaitForStmt(Expression*delay);
|
explicit WaitForStmt(Expression*delay);
|
||||||
|
|
||||||
void dump(std::ostream&out, int indent) const;
|
void dump(std::ostream&out, int indent) const override;
|
||||||
int elaborate(Entity*ent, ScopeBase*scope);
|
int elaborate(Entity*ent, ScopeBase*scope) override;
|
||||||
int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
|
||||||
void write_to_stream(std::ostream&fd);
|
void write_to_stream(std::ostream&fd) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Expression*delay_;
|
Expression*delay_;
|
||||||
|
|
@ -336,10 +336,10 @@ class WaitStmt : public SequentialStmt {
|
||||||
typedef enum { ON, UNTIL, FINAL } wait_type_t;
|
typedef enum { ON, UNTIL, FINAL } wait_type_t;
|
||||||
WaitStmt(wait_type_t typ, Expression*expression);
|
WaitStmt(wait_type_t typ, Expression*expression);
|
||||||
|
|
||||||
void dump(std::ostream&out, int indent) const;
|
void dump(std::ostream&out, int indent) const override;
|
||||||
int elaborate(Entity*ent, ScopeBase*scope);
|
int elaborate(Entity*ent, ScopeBase*scope) override;
|
||||||
int emit(std::ostream&out, Entity*entity, ScopeBase*scope);
|
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
|
||||||
void write_to_stream(std::ostream&fd);
|
void write_to_stream(std::ostream&fd) override;
|
||||||
|
|
||||||
inline wait_type_t type() const { return type_; }
|
inline wait_type_t type() const { return type_; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright CERN 2016-2021
|
* Copyright CERN 2016-2025
|
||||||
* @author Maciej Suminski (maciej.suminski@cern.ch)
|
* @author Maciej Suminski (maciej.suminski@cern.ch)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
|
|
@ -41,7 +41,7 @@ class SubprogramToInteger : public SubprogramStdHeader {
|
||||||
}
|
}
|
||||||
|
|
||||||
int emit_name(const std::vector<Expression*>&argv,
|
int emit_name(const std::vector<Expression*>&argv,
|
||||||
std::ostream&out, Entity*ent, ScopeBase*scope) const {
|
std::ostream&out, Entity*ent, ScopeBase*scope) const override {
|
||||||
bool signed_flag = false;
|
bool signed_flag = false;
|
||||||
|
|
||||||
// to_integer converts unsigned to natural
|
// to_integer converts unsigned to natural
|
||||||
|
|
@ -74,12 +74,12 @@ class SubprogramSizeCast : public SubprogramStdHeader {
|
||||||
}
|
}
|
||||||
|
|
||||||
int emit_name(const std::vector<Expression*>&,
|
int emit_name(const std::vector<Expression*>&,
|
||||||
std::ostream&, Entity*, ScopeBase*) const {
|
std::ostream&, Entity*, ScopeBase*) const override {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int emit_args(const std::vector<Expression*>&argv,
|
int emit_args(const std::vector<Expression*>&argv,
|
||||||
std::ostream&out, Entity*ent, ScopeBase*scope) const {
|
std::ostream&out, Entity*ent, ScopeBase*scope) const override {
|
||||||
int64_t new_size, old_size;
|
int64_t new_size, old_size;
|
||||||
|
|
||||||
const VType*type = argv[0]->probe_type(ent, scope);
|
const VType*type = argv[0]->probe_type(ent, scope);
|
||||||
|
|
@ -131,7 +131,7 @@ class SubprogramReadWrite : public SubprogramBuiltin {
|
||||||
enum format_t { FORMAT_STD, FORMAT_BOOL, FORMAT_TIME, FORMAT_HEX, FORMAT_STRING };
|
enum format_t { FORMAT_STD, FORMAT_BOOL, FORMAT_TIME, FORMAT_HEX, FORMAT_STRING };
|
||||||
|
|
||||||
int emit_args(const std::vector<Expression*>&argv,
|
int emit_args(const std::vector<Expression*>&argv,
|
||||||
std::ostream&out, Entity*ent, ScopeBase*scope) const {
|
std::ostream&out, Entity*ent, ScopeBase*scope) const override {
|
||||||
|
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ int SubprogramHeader::elaborate_argument(Expression*expr, int idx,
|
||||||
return expr->elaborate_expr(ent, scope, type);
|
return expr->elaborate_expr(ent, scope, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
SubprogramHeader*SubprogramHeader::make_instance(std::vector<Expression*> arguments,
|
SubprogramHeader*SubprogramHeader::make_instance(const std::vector<Expression*>&arguments,
|
||||||
ScopeBase*scope) const {
|
ScopeBase*scope) const {
|
||||||
assert(arguments.size() == ports_->size());
|
assert(arguments.size() == ports_->size());
|
||||||
|
|
||||||
|
|
@ -288,7 +288,7 @@ SubprogramHeader*SubprogramHeader::make_instance(std::vector<Expression*> argume
|
||||||
struct check_return_type : public SeqStmtVisitor {
|
struct check_return_type : public SeqStmtVisitor {
|
||||||
explicit check_return_type(const SubprogramBody*subp) : subp_(subp), ret_type_(NULL) {}
|
explicit check_return_type(const SubprogramBody*subp) : subp_(subp), ret_type_(NULL) {}
|
||||||
|
|
||||||
void operator() (SequentialStmt*s)
|
void operator() (SequentialStmt*s) override
|
||||||
{
|
{
|
||||||
const ReturnStmt*ret;
|
const ReturnStmt*ret;
|
||||||
if((ret = dynamic_cast<ReturnStmt*>(s))) {
|
if((ret = dynamic_cast<ReturnStmt*>(s))) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef IVL_subprogram_H
|
#ifndef IVL_subprogram_H
|
||||||
#define IVL_subprogram_H
|
#define IVL_subprogram_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2021 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2013-2025 Stephen Williams (steve@icarus.com)
|
||||||
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
|
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
|
||||||
* Copyright CERN 2015
|
* Copyright CERN 2015
|
||||||
* @author Maciej Suminski (maciej.suminski@cern.ch)
|
* @author Maciej Suminski (maciej.suminski@cern.ch)
|
||||||
|
|
@ -38,9 +38,9 @@ class SubprogramBody : public LineInfo, public ScopeBase {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SubprogramBody();
|
SubprogramBody();
|
||||||
~SubprogramBody();
|
~SubprogramBody() override;
|
||||||
|
|
||||||
const InterfacePort*find_param(perm_string nam) const;
|
const InterfacePort*find_param(perm_string nam) const override;
|
||||||
|
|
||||||
void set_statements(std::list<SequentialStmt*>*statements);
|
void set_statements(std::list<SequentialStmt*>*statements);
|
||||||
inline bool empty_statements() const { return !statements_ || statements_->empty(); }
|
inline bool empty_statements() const { return !statements_ || statements_->empty(); }
|
||||||
|
|
@ -55,7 +55,7 @@ class SubprogramBody : public LineInfo, public ScopeBase {
|
||||||
void dump(std::ostream&fd) const;
|
void dump(std::ostream&fd) const;
|
||||||
|
|
||||||
const SubprogramHeader*header() const { return header_; }
|
const SubprogramHeader*header() const { return header_; }
|
||||||
bool is_subprogram() const { return true; }
|
bool is_subprogram() const override { return true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::list<SequentialStmt*>*statements_;
|
std::list<SequentialStmt*>*statements_;
|
||||||
|
|
@ -68,7 +68,7 @@ class SubprogramHeader : public LineInfo {
|
||||||
public:
|
public:
|
||||||
SubprogramHeader(perm_string name, std::list<InterfacePort*>*ports,
|
SubprogramHeader(perm_string name, std::list<InterfacePort*>*ports,
|
||||||
const VType*return_type);
|
const VType*return_type);
|
||||||
virtual ~SubprogramHeader();
|
virtual ~SubprogramHeader() override;
|
||||||
|
|
||||||
// Return true if the specification (name, types, ports)
|
// Return true if the specification (name, types, ports)
|
||||||
// matches this subprogram and that subprogram.
|
// matches this subprogram and that subprogram.
|
||||||
|
|
@ -124,7 +124,7 @@ class SubprogramHeader : public LineInfo {
|
||||||
// a different type. It is used to allow VHDL functions that work with
|
// a different type. It is used to allow VHDL functions that work with
|
||||||
// unbounded std_logic_vectors, so there can be a separate instance
|
// unbounded std_logic_vectors, so there can be a separate instance
|
||||||
// for limited length logic vector.
|
// for limited length logic vector.
|
||||||
SubprogramHeader*make_instance(std::vector<Expression*> arguments, ScopeBase*scope) const;
|
SubprogramHeader*make_instance(const std::vector<Expression*>&arguments, ScopeBase*scope) const;
|
||||||
|
|
||||||
// Emit header as it would show up in a package.
|
// Emit header as it would show up in a package.
|
||||||
int emit_package(std::ostream&fd) const;
|
int emit_package(std::ostream&fd) const;
|
||||||
|
|
@ -154,9 +154,9 @@ class SubprogramStdHeader : public SubprogramHeader
|
||||||
SubprogramStdHeader(perm_string nam, std::list<InterfacePort*>*ports,
|
SubprogramStdHeader(perm_string nam, std::list<InterfacePort*>*ports,
|
||||||
const VType*return_type) :
|
const VType*return_type) :
|
||||||
SubprogramHeader(nam, ports, return_type) {}
|
SubprogramHeader(nam, ports, return_type) {}
|
||||||
virtual ~SubprogramStdHeader() {};
|
virtual ~SubprogramStdHeader() override {};
|
||||||
|
|
||||||
bool is_std() const { return true; }
|
bool is_std() const override { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// The simplest case, when only function name has to be changed.
|
// The simplest case, when only function name has to be changed.
|
||||||
|
|
@ -166,9 +166,9 @@ class SubprogramBuiltin : public SubprogramStdHeader
|
||||||
SubprogramBuiltin(perm_string vhdl_name, perm_string sv_name,
|
SubprogramBuiltin(perm_string vhdl_name, perm_string sv_name,
|
||||||
std::list<InterfacePort*>*ports, const VType*return_type) :
|
std::list<InterfacePort*>*ports, const VType*return_type) :
|
||||||
SubprogramStdHeader(vhdl_name, ports, return_type), sv_name_(sv_name) {}
|
SubprogramStdHeader(vhdl_name, ports, return_type), sv_name_(sv_name) {}
|
||||||
~SubprogramBuiltin() {}
|
~SubprogramBuiltin() override {}
|
||||||
|
|
||||||
int emit_name(const std::vector<Expression*>&, std::ostream&out, Entity*, ScopeBase*) const;
|
int emit_name(const std::vector<Expression*>&, std::ostream&out, Entity*, ScopeBase*) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// SystemVerilog counterpart function name
|
// SystemVerilog counterpart function name
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef IVL_vsignal_H
|
#ifndef IVL_vsignal_H
|
||||||
#define IVL_vsignal_H
|
#define IVL_vsignal_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2021 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -32,7 +32,7 @@ class SigVarBase : public LineInfo {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SigVarBase(perm_string name, const VType*type, Expression*init_expr);
|
SigVarBase(perm_string name, const VType*type, Expression*init_expr);
|
||||||
virtual ~SigVarBase();
|
virtual ~SigVarBase() override;
|
||||||
|
|
||||||
const VType* peek_type(void) const { return type_; }
|
const VType* peek_type(void) const { return type_; }
|
||||||
|
|
||||||
|
|
|
||||||
118
vhdlpp/vtype.h
118
vhdlpp/vtype.h
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef IVL_vtype_H
|
#ifndef IVL_vtype_H
|
||||||
#define IVL_vtype_H
|
#define IVL_vtype_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2021 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
|
||||||
* Copyright CERN 2014 / Stephen Williams (steve@icarus.com),
|
* Copyright CERN 2014 / Stephen Williams (steve@icarus.com),
|
||||||
* @author Maciej Suminski (maciej.suminski@cern.ch)
|
* @author Maciej Suminski (maciej.suminski@cern.ch)
|
||||||
*
|
*
|
||||||
|
|
@ -145,10 +145,10 @@ extern void preload_global_types(void);
|
||||||
* This type is a placeholder for ERROR types.
|
* This type is a placeholder for ERROR types.
|
||||||
*/
|
*/
|
||||||
class VTypeERROR : public VType {
|
class VTypeERROR : public VType {
|
||||||
VType*clone() const { return NULL; }
|
VType*clone() const override { return NULL; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int emit_def(std::ostream&out, perm_string name) const;
|
int emit_def(std::ostream&out, perm_string name) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -162,21 +162,21 @@ class VTypePrimitive : public VType {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VTypePrimitive(type_t tt, bool packed = false);
|
explicit VTypePrimitive(type_t tt, bool packed = false);
|
||||||
~VTypePrimitive();
|
~VTypePrimitive() override;
|
||||||
|
|
||||||
VType*clone() const { return new VTypePrimitive(*this); }
|
VType*clone() const override { return new VTypePrimitive(*this); }
|
||||||
|
|
||||||
bool type_match(const VType*that) const;
|
bool type_match(const VType*that) const override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
void show(std::ostream&) const;
|
void show(std::ostream&) const override;
|
||||||
int get_width(ScopeBase*scope) const;
|
int get_width(ScopeBase*scope) const override;
|
||||||
|
|
||||||
type_t type() const { return type_; }
|
type_t type() const { return type_; }
|
||||||
|
|
||||||
int emit_primitive_type(std::ostream&fd) const;
|
int emit_primitive_type(std::ostream&fd) const;
|
||||||
int emit_def(std::ostream&out, perm_string name) const;
|
int emit_def(std::ostream&out, perm_string name) const override;
|
||||||
|
|
||||||
bool can_be_packed() const { return packed_; }
|
bool can_be_packed() const override { return packed_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
type_t type_;
|
type_t type_;
|
||||||
|
|
@ -215,16 +215,16 @@ class VTypeArray : public VType {
|
||||||
VTypeArray(const VType*etype, const std::vector<range_t>&r, bool signed_vector = false);
|
VTypeArray(const VType*etype, const std::vector<range_t>&r, bool signed_vector = false);
|
||||||
VTypeArray(const VType*etype, std::list<ExpRange*>*r, bool signed_vector = false);
|
VTypeArray(const VType*etype, std::list<ExpRange*>*r, bool signed_vector = false);
|
||||||
VTypeArray(const VType*etype, int msb, int lsb, bool signed_vector = false);
|
VTypeArray(const VType*etype, int msb, int lsb, bool signed_vector = false);
|
||||||
~VTypeArray();
|
~VTypeArray() override;
|
||||||
|
|
||||||
VType*clone() const;
|
VType*clone() const override;
|
||||||
|
|
||||||
int elaborate(Entity*ent, ScopeBase*scope) const;
|
int elaborate(Entity*ent, ScopeBase*scope) const override;
|
||||||
bool type_match(const VType*that) const;
|
bool type_match(const VType*that) const override;
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
void write_type_to_stream(std::ostream&fd) const;
|
void write_type_to_stream(std::ostream&fd) const override;
|
||||||
void show(std::ostream&) const;
|
void show(std::ostream&) const override;
|
||||||
int get_width(ScopeBase*scope) const;
|
int get_width(ScopeBase*scope) const override;
|
||||||
|
|
||||||
const std::vector<range_t>&dimensions() const { return ranges_; };
|
const std::vector<range_t>&dimensions() const { return ranges_; };
|
||||||
const range_t&dimension(size_t idx) const
|
const range_t&dimension(size_t idx) const
|
||||||
|
|
@ -241,14 +241,14 @@ class VTypeArray : public VType {
|
||||||
// it be unfolded
|
// it be unfolded
|
||||||
const VType* basic_type(bool typedef_allowed = true) const;
|
const VType* basic_type(bool typedef_allowed = true) const;
|
||||||
|
|
||||||
int emit_def(std::ostream&out, perm_string name) const;
|
int emit_def(std::ostream&out, perm_string name) const override;
|
||||||
int emit_typedef(std::ostream&out, typedef_context_t&ctx) const;
|
int emit_typedef(std::ostream&out, typedef_context_t&ctx) const override;
|
||||||
|
|
||||||
bool can_be_packed() const { return etype_->can_be_packed(); }
|
bool can_be_packed() const override { return etype_->can_be_packed(); }
|
||||||
|
|
||||||
bool is_unbounded() const;
|
bool is_unbounded() const override;
|
||||||
|
|
||||||
bool is_variable_length(ScopeBase*scope) const;
|
bool is_variable_length(ScopeBase*scope) const override;
|
||||||
|
|
||||||
// To handle subtypes
|
// To handle subtypes
|
||||||
inline void set_parent_type(const VTypeArray*parent) { parent_ = parent; }
|
inline void set_parent_type(const VTypeArray*parent) { parent_ = parent; }
|
||||||
|
|
@ -276,11 +276,11 @@ class VTypeRange : public VType {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VTypeRange(const VType*base);
|
VTypeRange(const VType*base);
|
||||||
virtual ~VTypeRange() = 0;
|
virtual ~VTypeRange() override = 0;
|
||||||
|
|
||||||
bool write_std_types(std::ostream&fd) const;
|
bool write_std_types(std::ostream&fd) const;
|
||||||
int emit_def(std::ostream&out, perm_string name) const;
|
int emit_def(std::ostream&out, perm_string name) const override;
|
||||||
bool type_match(const VType*that) const;
|
bool type_match(const VType*that) const override;
|
||||||
|
|
||||||
// Get the type that is limited by the range.
|
// Get the type that is limited by the range.
|
||||||
inline const VType*base_type() const { return base_; }
|
inline const VType*base_type() const { return base_; }
|
||||||
|
|
@ -294,14 +294,14 @@ class VTypeRangeConst : public VTypeRange {
|
||||||
public:
|
public:
|
||||||
VTypeRangeConst(const VType*base, int64_t end, int64_t start);
|
VTypeRangeConst(const VType*base, int64_t end, int64_t start);
|
||||||
|
|
||||||
VType*clone() const {
|
VType*clone() const override {
|
||||||
return new VTypeRangeConst(base_type()->clone(), start_, end_);
|
return new VTypeRangeConst(base_type()->clone(), start_, end_);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t start() const { return start_; }
|
int64_t start() const { return start_; }
|
||||||
int64_t end() const { return end_; }
|
int64_t end() const { return end_; }
|
||||||
|
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int64_t start_, end_;
|
const int64_t start_, end_;
|
||||||
|
|
@ -311,13 +311,13 @@ class VTypeRangeExpr : public VTypeRange {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VTypeRangeExpr(const VType*base, Expression*end, Expression*start, bool downto);
|
VTypeRangeExpr(const VType*base, Expression*end, Expression*start, bool downto);
|
||||||
~VTypeRangeExpr();
|
~VTypeRangeExpr() override;
|
||||||
|
|
||||||
VType*clone() const;
|
VType*clone() const override;
|
||||||
int elaborate(Entity*end, ScopeBase*scope) const;
|
int elaborate(Entity*end, ScopeBase*scope) const override;
|
||||||
|
|
||||||
public: // Virtual methods
|
public: // Virtual methods
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Boundaries
|
// Boundaries
|
||||||
|
|
@ -331,16 +331,16 @@ class VTypeEnum : public VType {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VTypeEnum(const std::list<perm_string>*names);
|
explicit VTypeEnum(const std::list<perm_string>*names);
|
||||||
~VTypeEnum();
|
~VTypeEnum() override;
|
||||||
|
|
||||||
VType*clone() const { return new VTypeEnum(*this); }
|
VType*clone() const override { return new VTypeEnum(*this); }
|
||||||
|
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
void show(std::ostream&) const;
|
void show(std::ostream&) const override;
|
||||||
int get_width(ScopeBase*) const { return 32; }
|
int get_width(ScopeBase*) const override { return 32; }
|
||||||
|
|
||||||
int emit_def(std::ostream&out, perm_string name) const;
|
int emit_def(std::ostream&out, perm_string name) const override;
|
||||||
int emit_decl(std::ostream&out, perm_string name, bool reg_flag) const;
|
int emit_decl(std::ostream&out, perm_string name, bool reg_flag) const override;
|
||||||
|
|
||||||
// Checks if the name is stored in the enum.
|
// Checks if the name is stored in the enum.
|
||||||
bool has_name(perm_string name) const;
|
bool has_name(perm_string name) const;
|
||||||
|
|
@ -372,16 +372,16 @@ class VTypeRecord : public VType {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VTypeRecord(std::list<element_t*>*elements);
|
explicit VTypeRecord(std::list<element_t*>*elements);
|
||||||
~VTypeRecord();
|
~VTypeRecord() override;
|
||||||
|
|
||||||
VType*clone() const { return new VTypeRecord(*this); }
|
VType*clone() const override { return new VTypeRecord(*this); }
|
||||||
|
|
||||||
void write_to_stream(std::ostream&fd) const;
|
void write_to_stream(std::ostream&fd) const override;
|
||||||
void show(std::ostream&) const;
|
void show(std::ostream&) const override;
|
||||||
int get_width(ScopeBase*scope) const;
|
int get_width(ScopeBase*scope) const override;
|
||||||
int emit_def(std::ostream&out, perm_string name) const;
|
int emit_def(std::ostream&out, perm_string name) const override;
|
||||||
|
|
||||||
bool can_be_packed() const { return true; }
|
bool can_be_packed() const override { return true; }
|
||||||
const element_t* element_by_name(perm_string name, int*index = NULL) const;
|
const element_t* element_by_name(perm_string name, int*index = NULL) const;
|
||||||
inline const std::vector<element_t*> get_elements() const { return elements_; }
|
inline const std::vector<element_t*> get_elements() const { return elements_; }
|
||||||
|
|
||||||
|
|
@ -394,11 +394,11 @@ class VTypeDef : public VType {
|
||||||
public:
|
public:
|
||||||
explicit VTypeDef(perm_string name);
|
explicit VTypeDef(perm_string name);
|
||||||
explicit VTypeDef(perm_string name, const VType*is);
|
explicit VTypeDef(perm_string name, const VType*is);
|
||||||
virtual ~VTypeDef();
|
virtual ~VTypeDef() override;
|
||||||
|
|
||||||
VType*clone() const { return new VTypeDef(*this); }
|
VType*clone() const override { return new VTypeDef(*this); }
|
||||||
|
|
||||||
bool type_match(const VType*that) const;
|
bool type_match(const VType*that) const override;
|
||||||
|
|
||||||
inline perm_string peek_name() const { return name_; }
|
inline perm_string peek_name() const { return name_; }
|
||||||
|
|
||||||
|
|
@ -410,17 +410,17 @@ class VTypeDef : public VType {
|
||||||
// type, and this method gets it for us.
|
// type, and this method gets it for us.
|
||||||
inline const VType* peek_definition(void) const { return type_; }
|
inline const VType* peek_definition(void) const { return type_; }
|
||||||
|
|
||||||
virtual void write_to_stream(std::ostream&fd) const;
|
virtual void write_to_stream(std::ostream&fd) const override;
|
||||||
void write_type_to_stream(std::ostream&fd) const;
|
void write_type_to_stream(std::ostream&fd) const override;
|
||||||
int get_width(ScopeBase*scope) const { return type_->get_width(scope); }
|
int get_width(ScopeBase*scope) const override { return type_->get_width(scope); }
|
||||||
int emit_typedef(std::ostream&out, typedef_context_t&ctx) const;
|
int emit_typedef(std::ostream&out, typedef_context_t&ctx) const override;
|
||||||
|
|
||||||
int emit_def(std::ostream&out, perm_string name) const;
|
int emit_def(std::ostream&out, perm_string name) const override;
|
||||||
int emit_decl(std::ostream&out, perm_string name, bool reg_flag) const;
|
int emit_decl(std::ostream&out, perm_string name, bool reg_flag) const override;
|
||||||
|
|
||||||
bool can_be_packed() const { return type_->can_be_packed(); }
|
bool can_be_packed() const override { return type_->can_be_packed(); }
|
||||||
|
|
||||||
bool is_unbounded() const { return type_->is_unbounded(); }
|
bool is_unbounded() const override { return type_->is_unbounded(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
perm_string name_;
|
perm_string name_;
|
||||||
|
|
@ -431,7 +431,7 @@ class VSubTypeDef : public VTypeDef {
|
||||||
public:
|
public:
|
||||||
explicit VSubTypeDef(perm_string name) : VTypeDef(name) {}
|
explicit VSubTypeDef(perm_string name) : VTypeDef(name) {}
|
||||||
explicit VSubTypeDef(perm_string name, const VType*is) : VTypeDef(name, is) {}
|
explicit VSubTypeDef(perm_string name, const VType*is) : VTypeDef(name, is) {}
|
||||||
void write_typedef_to_stream(std::ostream&fd, perm_string name) const;
|
void write_typedef_to_stream(std::ostream&fd, perm_string name) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* IVL_vtype_H */
|
#endif /* IVL_vtype_H */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue