Pass on lexical position information to NetNet and NetEvent objects.

This commit is contained in:
Martin Whitaker 2024-02-18 16:47:10 +00:00
parent bb80ee6905
commit 4159a6a6b1
4 changed files with 13 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2022 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2024 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
@ -1553,6 +1553,7 @@ void PGModule::elaborate_scope_mod_instances_(Design*des, Module*mod, NetScope*s
void PEvent::elaborate_scope(Design*, NetScope*scope) const void PEvent::elaborate_scope(Design*, NetScope*scope) const
{ {
NetEvent*ev = new NetEvent(name_); NetEvent*ev = new NetEvent(name_);
ev->lexical_pos(lexical_pos_);
ev->set_line(*this); ev->set_line(*this);
scope->add_event(ev); scope->add_event(ev);
} }

View File

@ -1209,6 +1209,7 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
if (wtype == NetNet::WIRE) sig->devirtualize_pins(); if (wtype == NetNet::WIRE) sig->devirtualize_pins();
sig->set_line(*this); sig->set_line(*this);
sig->port_type(port_type_); sig->port_type(port_type_);
sig->lexical_pos(lexical_pos_);
if (ivl_discipline_t dis = get_discipline()) { if (ivl_discipline_t dis = get_discipline()) {
sig->set_discipline(dis); sig->set_discipline(dis);

View File

@ -557,7 +557,7 @@ NetNet::NetNet(NetScope*s, perm_string n, Type t,
const netranges_t&unpacked, ivl_type_t use_net_type) const netranges_t&unpacked, ivl_type_t use_net_type)
: NetObj(s, n, calculate_count(unpacked)), : NetObj(s, n, calculate_count(unpacked)),
type_(t), port_type_(NOT_A_PORT), coerced_to_uwire_(false), type_(t), port_type_(NOT_A_PORT), coerced_to_uwire_(false),
local_flag_(false), net_type_(use_net_type), local_flag_(false), lexical_pos_(0), net_type_(use_net_type),
discipline_(0), unpacked_dims_(unpacked), discipline_(0), unpacked_dims_(unpacked),
eref_count_(0), lref_count_(0) eref_count_(0), lref_count_(0)
{ {
@ -580,7 +580,7 @@ NetNet::NetNet(NetScope*s, perm_string n, Type t,
NetNet::NetNet(NetScope*s, perm_string n, Type t, ivl_type_t type) NetNet::NetNet(NetScope*s, perm_string n, Type t, ivl_type_t type)
: NetObj(s, n, 1), : NetObj(s, n, 1),
type_(t), port_type_(NOT_A_PORT), coerced_to_uwire_(false), type_(t), port_type_(NOT_A_PORT), coerced_to_uwire_(false),
local_flag_(false), net_type_(type), local_flag_(false), lexical_pos_(0), net_type_(type),
discipline_(0), discipline_(0),
eref_count_(0), lref_count_(0) eref_count_(0), lref_count_(0)
{ {

View File

@ -695,6 +695,9 @@ class NetNet : public NetObj, public PortType {
PortType port_type() const; PortType port_type() const;
void port_type(PortType t); void port_type(PortType t);
unsigned lexical_pos() const { return lexical_pos_; }
void lexical_pos(unsigned lp) { lexical_pos_ = lp; }
// If this net net is a port (i.e. a *sub*port net of a module port) // If this net net is a port (i.e. a *sub*port net of a module port)
// its port index is number of the module it connects through // its port index is number of the module it connects through
int get_module_port_index() const; // -1 Not connected to port... int get_module_port_index() const; // -1 Not connected to port...
@ -819,6 +822,7 @@ class NetNet : public NetObj, public PortType {
PortType port_type_ : 3; PortType port_type_ : 3;
bool coerced_to_uwire_: 1; bool coerced_to_uwire_: 1;
bool local_flag_: 1; bool local_flag_: 1;
unsigned lexical_pos_;
ivl_type_t net_type_; ivl_type_t net_type_;
netuarray_t *array_type_ = nullptr; netuarray_t *array_type_ = nullptr;
ivl_discipline_t discipline_; ivl_discipline_t discipline_;
@ -3421,6 +3425,9 @@ class NetEvent : public LineInfo {
perm_string name() const; perm_string name() const;
unsigned lexical_pos() const { return lexical_pos_; }
void lexical_pos(unsigned lp) { lexical_pos_ = lp; }
bool local_flag() const { return local_flag_; } bool local_flag() const { return local_flag_; }
void local_flag(bool f) { local_flag_ = f; } void local_flag(bool f) { local_flag_ = f; }
@ -3455,6 +3462,7 @@ class NetEvent : public LineInfo {
private: private:
perm_string name_; perm_string name_;
unsigned lexical_pos_;
bool local_flag_; bool local_flag_;
// The NetScope class uses these to list the events. // The NetScope class uses these to list the events.