Add lexical position information to PWire and PEvent objects.
This commit is contained in:
parent
079108f32b
commit
bb80ee6905
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2019 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2004-2024 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
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
|
|
||||||
# include "PEvent.h"
|
# include "PEvent.h"
|
||||||
|
|
||||||
PEvent::PEvent(perm_string n)
|
PEvent::PEvent(perm_string n, unsigned lexical_pos)
|
||||||
: name_(n)
|
: name_(n), lexical_pos_(lexical_pos)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
7
PEvent.h
7
PEvent.h
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef IVL_PEvent_H
|
#ifndef IVL_PEvent_H
|
||||||
#define IVL_PEvent_H
|
#define IVL_PEvent_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000-2019 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2000-2024 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
|
||||||
|
|
@ -36,17 +36,20 @@ class PEvent : public PNamedItem {
|
||||||
public:
|
public:
|
||||||
// The name is a perm-allocated string. It is the simple name
|
// The name is a perm-allocated string. It is the simple name
|
||||||
// of the event, without any scope.
|
// of the event, without any scope.
|
||||||
explicit PEvent(perm_string name);
|
explicit PEvent(perm_string name, unsigned lexical_pos);
|
||||||
~PEvent();
|
~PEvent();
|
||||||
|
|
||||||
perm_string name() const;
|
perm_string name() const;
|
||||||
|
|
||||||
|
unsigned lexical_pos() const { return lexical_pos_; }
|
||||||
|
|
||||||
void elaborate_scope(Design*des, NetScope*scope) const;
|
void elaborate_scope(Design*des, NetScope*scope) const;
|
||||||
|
|
||||||
SymbolType symbol_type() const;
|
SymbolType symbol_type() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
perm_string name_;
|
perm_string name_;
|
||||||
|
unsigned lexical_pos_;
|
||||||
|
|
||||||
private: // not implemented
|
private: // not implemented
|
||||||
PEvent(const PEvent&);
|
PEvent(const PEvent&);
|
||||||
|
|
|
||||||
2
PExpr.cc
2
PExpr.cc
|
|
@ -426,7 +426,7 @@ void PEIdent::declare_implicit_nets(LexicalScope*scope, NetNet::Type type)
|
||||||
|
|
||||||
ss = ss->parent_scope();
|
ss = ss->parent_scope();
|
||||||
}
|
}
|
||||||
PWire*net = new PWire(name, type, NetNet::NOT_A_PORT);
|
PWire*net = new PWire(name, lexical_pos_, type, NetNet::NOT_A_PORT);
|
||||||
net->set_file(get_file());
|
net->set_file(get_file());
|
||||||
net->set_lineno(get_lineno());
|
net->set_lineno(get_lineno());
|
||||||
scope->wires[name] = net;
|
scope->wires[name] = net;
|
||||||
|
|
|
||||||
5
PWire.cc
5
PWire.cc
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 1999-2024 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
|
||||||
|
|
@ -25,10 +25,11 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
PWire::PWire(perm_string n,
|
PWire::PWire(perm_string n,
|
||||||
|
unsigned lp,
|
||||||
NetNet::Type t,
|
NetNet::Type t,
|
||||||
NetNet::PortType pt,
|
NetNet::PortType pt,
|
||||||
PWSRType rt)
|
PWSRType rt)
|
||||||
: name_(n), type_(t), port_type_(pt), signed_(false),
|
: name_(n), lexical_pos_(lp), type_(t), port_type_(pt), signed_(false),
|
||||||
port_set_(false), net_set_(false), is_scalar_(false),
|
port_set_(false), net_set_(false), is_scalar_(false),
|
||||||
error_cnt_(0), discipline_(0)
|
error_cnt_(0), discipline_(0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
6
PWire.h
6
PWire.h
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef IVL_PWire_H
|
#ifndef IVL_PWire_H
|
||||||
#define IVL_PWire_H
|
#define IVL_PWire_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 1998-2024 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
|
||||||
|
|
@ -55,6 +55,7 @@ class PWire : public PNamedItem {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PWire(perm_string name,
|
PWire(perm_string name,
|
||||||
|
unsigned lexical_pos,
|
||||||
NetNet::Type t,
|
NetNet::Type t,
|
||||||
NetNet::PortType pt,
|
NetNet::PortType pt,
|
||||||
PWSRType rt = SR_NET);
|
PWSRType rt = SR_NET);
|
||||||
|
|
@ -62,6 +63,8 @@ class PWire : public PNamedItem {
|
||||||
// Return a hierarchical name.
|
// Return a hierarchical name.
|
||||||
perm_string basename() const;
|
perm_string basename() const;
|
||||||
|
|
||||||
|
unsigned lexical_pos() const { return lexical_pos_; }
|
||||||
|
|
||||||
NetNet::Type get_wire_type() const;
|
NetNet::Type get_wire_type() const;
|
||||||
bool set_wire_type(NetNet::Type);
|
bool set_wire_type(NetNet::Type);
|
||||||
|
|
||||||
|
|
@ -99,6 +102,7 @@ class PWire : public PNamedItem {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
perm_string name_;
|
perm_string name_;
|
||||||
|
unsigned lexical_pos_;
|
||||||
NetNet::Type type_;
|
NetNet::Type type_;
|
||||||
NetNet::PortType port_type_;
|
NetNet::PortType port_type_;
|
||||||
bool signed_;
|
bool signed_;
|
||||||
|
|
|
||||||
6
parse.y
6
parse.y
|
|
@ -7249,7 +7249,7 @@ udp_port_decl
|
||||||
{ $$ = pform_make_udp_input_ports($2); }
|
{ $$ = pform_make_udp_input_ports($2); }
|
||||||
| K_output IDENTIFIER ';'
|
| K_output IDENTIFIER ';'
|
||||||
{ perm_string pname = lex_strings.make($2);
|
{ perm_string pname = lex_strings.make($2);
|
||||||
PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT);
|
PWire*pp = new PWire(pname, @2.lexical_pos, NetNet::IMPLICIT, NetNet::POUTPUT);
|
||||||
vector<PWire*>*tmp = new std::vector<PWire*>(1);
|
vector<PWire*>*tmp = new std::vector<PWire*>(1);
|
||||||
(*tmp)[0] = pp;
|
(*tmp)[0] = pp;
|
||||||
$$ = tmp;
|
$$ = tmp;
|
||||||
|
|
@ -7257,7 +7257,7 @@ udp_port_decl
|
||||||
}
|
}
|
||||||
| K_reg IDENTIFIER ';'
|
| K_reg IDENTIFIER ';'
|
||||||
{ perm_string pname = lex_strings.make($2);
|
{ perm_string pname = lex_strings.make($2);
|
||||||
PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT);
|
PWire*pp = new PWire(pname, @2.lexical_pos, NetNet::REG, NetNet::PIMPLICIT);
|
||||||
vector<PWire*>*tmp = new std::vector<PWire*>(1);
|
vector<PWire*>*tmp = new std::vector<PWire*>(1);
|
||||||
(*tmp)[0] = pp;
|
(*tmp)[0] = pp;
|
||||||
$$ = tmp;
|
$$ = tmp;
|
||||||
|
|
@ -7265,7 +7265,7 @@ udp_port_decl
|
||||||
}
|
}
|
||||||
| K_output K_reg IDENTIFIER ';'
|
| K_output K_reg IDENTIFIER ';'
|
||||||
{ perm_string pname = lex_strings.make($3);
|
{ perm_string pname = lex_strings.make($3);
|
||||||
PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT);
|
PWire*pp = new PWire(pname, @3.lexical_pos, NetNet::REG, NetNet::POUTPUT);
|
||||||
vector<PWire*>*tmp = new std::vector<PWire*>(1);
|
vector<PWire*>*tmp = new std::vector<PWire*>(1);
|
||||||
(*tmp)[0] = pp;
|
(*tmp)[0] = pp;
|
||||||
$$ = tmp;
|
$$ = tmp;
|
||||||
|
|
|
||||||
10
pform.cc
10
pform.cc
|
|
@ -2056,7 +2056,7 @@ void pform_make_udp(const struct vlltype&loc, perm_string name,
|
||||||
std::vector<PWire*> pins(parms->size() + 1);
|
std::vector<PWire*> pins(parms->size() + 1);
|
||||||
|
|
||||||
/* Make the PWire for the output port. */
|
/* Make the PWire for the output port. */
|
||||||
pins[0] = new PWire(out_name,
|
pins[0] = new PWire(out_name, loc.lexical_pos,
|
||||||
synchronous_flag? NetNet::REG : NetNet::WIRE,
|
synchronous_flag? NetNet::REG : NetNet::WIRE,
|
||||||
NetNet::POUTPUT);
|
NetNet::POUTPUT);
|
||||||
FILE_NAME(pins[0], loc);
|
FILE_NAME(pins[0], loc);
|
||||||
|
|
@ -2068,7 +2068,7 @@ void pform_make_udp(const struct vlltype&loc, perm_string name,
|
||||||
; cur != parms->end()
|
; cur != parms->end()
|
||||||
; idx += 1, ++ cur) {
|
; idx += 1, ++ cur) {
|
||||||
ivl_assert(loc, idx < pins.size());
|
ivl_assert(loc, idx < pins.size());
|
||||||
pins[idx] = new PWire(*cur, NetNet::WIRE,
|
pins[idx] = new PWire(*cur, loc.lexical_pos, NetNet::WIRE,
|
||||||
NetNet::PINPUT);
|
NetNet::PINPUT);
|
||||||
FILE_NAME(pins[idx], loc);
|
FILE_NAME(pins[idx], loc);
|
||||||
}
|
}
|
||||||
|
|
@ -2153,7 +2153,7 @@ static void pform_set_net_range(PWire *wire,
|
||||||
*/
|
*/
|
||||||
static void pform_make_event(const struct vlltype&loc, perm_string name)
|
static void pform_make_event(const struct vlltype&loc, perm_string name)
|
||||||
{
|
{
|
||||||
PEvent*event = new PEvent(name);
|
PEvent*event = new PEvent(name, loc.lexical_pos);
|
||||||
FILE_NAME(event, loc);
|
FILE_NAME(event, loc);
|
||||||
|
|
||||||
add_local_symbol(lexical_scope, name, event);
|
add_local_symbol(lexical_scope, name, event);
|
||||||
|
|
@ -2547,7 +2547,7 @@ static PWire* pform_get_or_make_wire(const struct vlltype&li, perm_string name,
|
||||||
// to the scope. Do not delete the old wire - it will
|
// to the scope. Do not delete the old wire - it will
|
||||||
// remain in the local symbol map.
|
// remain in the local symbol map.
|
||||||
|
|
||||||
cur = new PWire(name, type, ptype, rt);
|
cur = new PWire(name, li.lexical_pos, type, ptype, rt);
|
||||||
FILE_NAME(cur, li);
|
FILE_NAME(cur, li);
|
||||||
|
|
||||||
pform_put_wire_in_scope(name, cur);
|
pform_put_wire_in_scope(name, cur);
|
||||||
|
|
@ -3243,7 +3243,7 @@ vector<PWire*>* pform_make_udp_input_ports(list<perm_string>*names)
|
||||||
for (list<perm_string>::iterator cur = names->begin()
|
for (list<perm_string>::iterator cur = names->begin()
|
||||||
; cur != names->end() ; ++ cur ) {
|
; cur != names->end() ; ++ cur ) {
|
||||||
perm_string txt = *cur;
|
perm_string txt = *cur;
|
||||||
PWire*pp = new PWire(txt,
|
PWire*pp = new PWire(txt, /* FIXME */ 0,
|
||||||
NetNet::IMPLICIT,
|
NetNet::IMPLICIT,
|
||||||
NetNet::PINPUT);
|
NetNet::PINPUT);
|
||||||
(*out)[idx] = pp;
|
(*out)[idx] = pp;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue