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
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
# include "PEvent.h"
|
||||
|
||||
PEvent::PEvent(perm_string n)
|
||||
: name_(n)
|
||||
PEvent::PEvent(perm_string n, unsigned lexical_pos)
|
||||
: name_(n), lexical_pos_(lexical_pos)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
7
PEvent.h
7
PEvent.h
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef 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
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -36,17 +36,20 @@ class PEvent : public PNamedItem {
|
|||
public:
|
||||
// The name is a perm-allocated string. It is the simple name
|
||||
// of the event, without any scope.
|
||||
explicit PEvent(perm_string name);
|
||||
explicit PEvent(perm_string name, unsigned lexical_pos);
|
||||
~PEvent();
|
||||
|
||||
perm_string name() const;
|
||||
|
||||
unsigned lexical_pos() const { return lexical_pos_; }
|
||||
|
||||
void elaborate_scope(Design*des, NetScope*scope) const;
|
||||
|
||||
SymbolType symbol_type() const;
|
||||
|
||||
private:
|
||||
perm_string name_;
|
||||
unsigned lexical_pos_;
|
||||
|
||||
private: // not implemented
|
||||
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();
|
||||
}
|
||||
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_lineno(get_lineno());
|
||||
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
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -25,10 +25,11 @@
|
|||
using namespace std;
|
||||
|
||||
PWire::PWire(perm_string n,
|
||||
unsigned lp,
|
||||
NetNet::Type t,
|
||||
NetNet::PortType pt,
|
||||
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),
|
||||
error_cnt_(0), discipline_(0)
|
||||
{
|
||||
|
|
|
|||
6
PWire.h
6
PWire.h
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef 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
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -55,6 +55,7 @@ class PWire : public PNamedItem {
|
|||
|
||||
public:
|
||||
PWire(perm_string name,
|
||||
unsigned lexical_pos,
|
||||
NetNet::Type t,
|
||||
NetNet::PortType pt,
|
||||
PWSRType rt = SR_NET);
|
||||
|
|
@ -62,6 +63,8 @@ class PWire : public PNamedItem {
|
|||
// Return a hierarchical name.
|
||||
perm_string basename() const;
|
||||
|
||||
unsigned lexical_pos() const { return lexical_pos_; }
|
||||
|
||||
NetNet::Type get_wire_type() const;
|
||||
bool set_wire_type(NetNet::Type);
|
||||
|
||||
|
|
@ -99,6 +102,7 @@ class PWire : public PNamedItem {
|
|||
|
||||
private:
|
||||
perm_string name_;
|
||||
unsigned lexical_pos_;
|
||||
NetNet::Type type_;
|
||||
NetNet::PortType port_type_;
|
||||
bool signed_;
|
||||
|
|
|
|||
6
parse.y
6
parse.y
|
|
@ -7249,7 +7249,7 @@ udp_port_decl
|
|||
{ $$ = pform_make_udp_input_ports($2); }
|
||||
| K_output IDENTIFIER ';'
|
||||
{ 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);
|
||||
(*tmp)[0] = pp;
|
||||
$$ = tmp;
|
||||
|
|
@ -7257,7 +7257,7 @@ udp_port_decl
|
|||
}
|
||||
| K_reg IDENTIFIER ';'
|
||||
{ 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);
|
||||
(*tmp)[0] = pp;
|
||||
$$ = tmp;
|
||||
|
|
@ -7265,7 +7265,7 @@ udp_port_decl
|
|||
}
|
||||
| K_output K_reg IDENTIFIER ';'
|
||||
{ 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);
|
||||
(*tmp)[0] = pp;
|
||||
$$ = 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);
|
||||
|
||||
/* 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,
|
||||
NetNet::POUTPUT);
|
||||
FILE_NAME(pins[0], loc);
|
||||
|
|
@ -2068,7 +2068,7 @@ void pform_make_udp(const struct vlltype&loc, perm_string name,
|
|||
; cur != parms->end()
|
||||
; idx += 1, ++ cur) {
|
||||
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);
|
||||
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)
|
||||
{
|
||||
PEvent*event = new PEvent(name);
|
||||
PEvent*event = new PEvent(name, loc.lexical_pos);
|
||||
FILE_NAME(event, loc);
|
||||
|
||||
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
|
||||
// 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);
|
||||
|
||||
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()
|
||||
; cur != names->end() ; ++ cur ) {
|
||||
perm_string txt = *cur;
|
||||
PWire*pp = new PWire(txt,
|
||||
PWire*pp = new PWire(txt, /* FIXME */ 0,
|
||||
NetNet::IMPLICIT,
|
||||
NetNet::PINPUT);
|
||||
(*out)[idx] = pp;
|
||||
|
|
|
|||
Loading…
Reference in New Issue