Skip to content

Commit

Permalink
XX
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
  • Loading branch information
mballance committed Nov 8, 2023
1 parent 8d6c72e commit 108233a
Show file tree
Hide file tree
Showing 11 changed files with 5,893 additions and 2,714 deletions.
2 changes: 1 addition & 1 deletion src/.antlr/PSSParser.interp

Large diffs are not rendered by default.

8,473 changes: 5,775 additions & 2,698 deletions src/.antlr/PSSParser.java

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/TaskCompareParamLists.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ namespace zsp {
namespace parser {


TaskCompareParamLists::TaskCompareParamLists(IFactory *factory) :
m_tref_comp(factory) {
TaskCompareParamLists::TaskCompareParamLists(
IFactory *factory,
ast::ISymbolScope *root) :
m_tref_comp(factory, root) {
DEBUG_INIT("TaskCompareParamLists", factory->getDebugMgr());

}
Expand Down
4 changes: 3 additions & 1 deletion src/TaskCompareParamLists.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ namespace parser {

class TaskCompareParamLists : public ast::VisitorBase {
public:
TaskCompareParamLists(IFactory *factory);
TaskCompareParamLists(
IFactory *factory,
ast::ISymbolScope *root);

virtual ~TaskCompareParamLists();

Expand Down
6 changes: 4 additions & 2 deletions src/TaskCompareTypeRefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ namespace zsp {
namespace parser {


TaskCompareTypeRefs::TaskCompareTypeRefs(IFactory *factory) :
m_expr_eval(factory), m_comp_val(factory->getDebugMgr()) {
TaskCompareTypeRefs::TaskCompareTypeRefs(
IFactory *factory,
ast::ISymbolScope *root) :
m_expr_eval(factory, root), m_root(root), m_comp_val(factory->getDebugMgr()) {
DEBUG_INIT("zsp::parser::TaskCompareTypeRefs", factory->getDebugMgr());
}

Expand Down
5 changes: 4 additions & 1 deletion src/TaskCompareTypeRefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ namespace parser {

class TaskCompareTypeRefs : public virtual ast::VisitorBase {
public:
TaskCompareTypeRefs(IFactory *factory);
TaskCompareTypeRefs(
IFactory *factory,
ast::ISymbolScope *root);

virtual ~TaskCompareTypeRefs();

Expand All @@ -57,6 +59,7 @@ class TaskCompareTypeRefs : public virtual ast::VisitorBase {

private:
static dmgr::IDebug *m_dbg;
ast::ISymbolScope *m_root;
TaskEvalExpr m_expr_eval;
TaskCompareVal m_comp_val;
ast::IDataTypeInt *m_type_int;
Expand Down
2 changes: 1 addition & 1 deletion src/TaskGetSpecializedTemplateType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ast::ISymbolRefPath *TaskGetSpecializedTemplateType::find(

// Search through the list of available specializations for
// a matching one
TaskCompareParamLists p_comp(m_factory);
TaskCompareParamLists p_comp(m_factory, m_root);
DEBUG("There are %d existing specializations", type_up->getSpec_types().size());
for (int32_t i=0; i<type_up->getSpec_types().size(); i++) {
ast::ISymbolTypeScope *sym_type_s_t = type_up->getSpec_types().at(i).get();
Expand Down
9 changes: 8 additions & 1 deletion src/TaskResolveRefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,14 @@ void TaskResolveRefs::visitExprRefPathId(ast::IExprRefPathId *i) {
i
);
if (!target) {
fprintf(stdout, "Failed to resolve ref-path %s\n", i->getId()->getId().c_str());
char tmp[1024];
sprintf(tmp, "Failed to resolve ref-path %s", i->getId()->getId().c_str());
IMarkerUP marker(m_factory->mkMarker(
tmp,
MarkerSeverityE::Error,
i->getId()->getLocation()
));
m_marker_l->marker(marker.get());
}
i->setTarget(target);
DEBUG_LEAVE("visitExprRefPathId");
Expand Down
2 changes: 1 addition & 1 deletion src/include/zsp/parser/impl/TaskCopyAst.h
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ class TaskCopyAst : public ast::VisitorBase {
virtual void visitPackageScope(ast::IPackageScope *i) { }

virtual void visitFunctionPrototype(ast::IFunctionPrototype *i) override {
DEBUG_ENTER("visitFunctionPrototype %s", i->getName().c_str());
DEBUG_ENTER("visitFunctionPrototype %s", i->getName()->getId().c_str());
ast::IFunctionPrototype *ic = m_factory->mkFunctionPrototype(
copyT<ast::IExprId>(i->getName()),
(i->getRtype())?copy(i->getRtype()):0,
Expand Down
92 changes: 89 additions & 3 deletions src/include/zsp/parser/impl/TaskEvalExpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "zsp/ast/impl/VisitorBase.h"
#include "zsp/parser/IFactory.h"
#include "zsp/parser/IVal.h"
#include "zsp/parser/impl/TaskResolveSymbolPathRef.h"

namespace zsp {
namespace parser {
Expand All @@ -32,8 +33,10 @@ namespace parser {

class TaskEvalExpr : public virtual ast::VisitorBase {
public:
TaskEvalExpr(IFactory *factory) :
m_dbg(0), m_factory(factory) {
TaskEvalExpr(
IFactory *factory,
ast::ISymbolScope *root) :
m_dbg(0), m_factory(factory), m_root(root) {
DEBUG_INIT("zsp::parser::TaskEvalExpr", factory->getDebugMgr());
}

Expand All @@ -56,7 +59,9 @@ class TaskEvalExpr : public virtual ast::VisitorBase {
}

virtual void visitExprBin(ast::IExprBin *i) override {
DEBUG_ENTER("visitExprBin");
DEBUG_ENTER("visitExprBin %d", i->getOp());
i->getLhs()->accept(m_this);
i->getRhs()->accept(m_this);
DEBUG("TODO: visitExprBin");
DEBUG_LEAVE("visitExprBin");
}
Expand Down Expand Up @@ -127,6 +132,55 @@ class TaskEvalExpr : public virtual ast::VisitorBase {
DEBUG_LEAVE("visitExprOpenRangeValue");
}

virtual void visitExprRefPath(ast::IExprRefPath *i) override {
DEBUG_ENTER("visitExprRefPath");
if (i->getTarget()) {
ast::IScopeChild *target = TaskResolveSymbolPathRef(
m_factory->getDebugMgr(),
m_root).resolve(i->getTarget());
if (target) {
target->accept(m_this);
} else {
DEBUG("Error: failed to resolve RefPath");
}
} else {
DEBUG("Error: ExprRefPath has null target");
}
DEBUG_LEAVE("visitExprRefPath");
}

virtual void visitExprRefPathId(ast::IExprRefPathId *i) override {
DEBUG_ENTER("visitExprRefPathId %s", (i->getId())?i->getId()->getId().c_str():"null");
if (i->getTarget()) {
DEBUG("Target is set");
i->getTarget()->accept(m_this);
} else {
DEBUG("Error: Target not set");
}
DEBUG_LEAVE("visitExprRefPathId");
}

virtual void visitExprRefPathContext(ast::IExprRefPathContext *i) override {
DEBUG_ENTER("visitExprRefPathContext");
ast::IScopeChild *target = TaskResolveSymbolPathRef(
m_factory->getDebugMgr(),
m_root).resolve(i->getTarget());
target->accept(m_this);
DEBUG_LEAVE("visitExprRefPathContext");
}

virtual void visitExprStaticRefPath(ast::IExprStaticRefPath *i) override {
DEBUG_ENTER("visitExprStaticRefPath");
DEBUG("TODO: visitExprStaticRefPath");
/*
ast::IScopeChild *target = TaskResolveSymbolPathRef(
m_factory->getDebugMgr(),
m_root).resolve(i->getTarget());
target->accept(m_this);
*/
DEBUG_LEAVE("visitExprStaticRefPath");
}

virtual void visitExprNull(ast::IExprNull *i) override {
DEBUG_ENTER("visitExprNull");
DEBUG("TODO: visitExprNull");
Expand Down Expand Up @@ -163,9 +217,41 @@ class TaskEvalExpr : public virtual ast::VisitorBase {
DEBUG_LEAVE("visitExprUnsignedNumber");
}

virtual void visitTemplateParamTypeValue(ast::ITemplateParamTypeValue *i) override {
DEBUG_ENTER("visitTemplateParamTypeValue");
DEBUG_LEAVE("visitTemplateParamTypeValue");
}

virtual void visitTemplateParamExprValue(ast::ITemplateParamExprValue *i) override {
DEBUG_ENTER("visitTemplateParamExprValue");
DEBUG_LEAVE("visitTemplateParamExprValue");
}

virtual void visitTemplateGenericTypeParamDecl(ast::ITemplateGenericTypeParamDecl *i) override {
DEBUG_ENTER("visitTemplateGenericTypeParamDecl");
DEBUG("TODO: visitTemplateGenericTypeParamDecl");
DEBUG_LEAVE("visitTemplateGenericTypeParamDecl");
}

virtual void visitTemplateCategoryTypeParamDecl(ast::ITemplateCategoryTypeParamDecl *i) override {
DEBUG_ENTER("visitTemplateCategoryTypeParamDecl");
DEBUG("TODO: visitTemplateCategoryTypeParamDecl");
DEBUG_LEAVE("visitTemplateCategoryTypeParamDecl");
}

virtual void visitTemplateValueParamDecl(ast::ITemplateValueParamDecl *i) override {
DEBUG_ENTER("visitTemplateValueParamDecl");
if (i->getDflt()) {
i->getDflt()->accept(m_this);
}
DEBUG("TODO: visitTemplateValueParamDecl");
DEBUG_LEAVE("visitTemplateValueParamDecl");
}

private:
dmgr::IDebug *m_dbg;
IFactory *m_factory;
ast::ISymbolScope *m_root;
IValUP m_val;

};
Expand Down
6 changes: 3 additions & 3 deletions src/stdlib/addr_reg_pkg.pss
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ extend component executor_base_c {

enum reg_access {READWRITE, READONLY, WRITEONLY};

pure component reg_c < type R, reg_access ACC = READWRITE, int SZ = (8*sizeof_s<R>::nbytes)> {
pure component reg_c < type R, reg_access ACC = READWRITE, int SZ2 = (8*sizeof_s<R>::nbytes)> {
function R read();
import target function read;
function void write(R r);
import target function write;
function bit[SZ] read_val();
function bit[SZ2] read_val();
import target function read_val;
function void write_val(bit[SZ] r);
function void write_val(bit[SZ2] r);
import target function write_val;
};

Expand Down

0 comments on commit 108233a

Please sign in to comment.