Update PSpecPath to take the polarity and full_flag when constructed

To avoid a variables not initialized in the construct this patch modifies
the PSpecPath class to take the polarity and full_flag as arguments to
the constructor.
This commit is contained in:
Cary R 2011-11-22 19:38:36 -08:00
parent 5b1e2c8c6c
commit 4c6a5bbd89
5 changed files with 14 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2006 Stephen Williams <steve@icarus.com> * Copyright (c) 2006-2011 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
@ -19,11 +19,14 @@
# include "PSpec.h" # include "PSpec.h"
PSpecPath::PSpecPath(unsigned src_cnt, unsigned dst_cnt) PSpecPath::PSpecPath(unsigned src_cnt, unsigned dst_cnt, char polarity,
bool full_flag)
: conditional(false), condition(0), edge(0), : conditional(false), condition(0), edge(0),
src(src_cnt), dst(dst_cnt), src(src_cnt), dst(dst_cnt),
data_source_expression(0) data_source_expression(0)
{ {
full_flag_ = full_flag;
polarity_ = polarity;
} }
PSpecPath::~PSpecPath() PSpecPath::~PSpecPath()

View File

@ -56,7 +56,8 @@ class PExpr;
class PSpecPath : public LineInfo { class PSpecPath : public LineInfo {
public: public:
PSpecPath(unsigned src_cnt, unsigned dst_cnt); PSpecPath(unsigned src_cnt, unsigned dst_cnt, char polarity,
bool full_flag);
~PSpecPath(); ~PSpecPath();
void elaborate(class Design*des, class NetScope*scope) const; void elaborate(class Design*des, class NetScope*scope) const;
@ -70,9 +71,9 @@ class PSpecPath : public LineInfo {
// Edge specification (-1==negedge, 0 = no edge, 1==posedge) // Edge specification (-1==negedge, 0 = no edge, 1==posedge)
int edge; int edge;
// Is this a full connection. // Is this a full connection.
bool full_flag; bool full_flag_;
// What is the polarity of the connection. // What is the polarity of the connection.
char polarity; char polarity_;
// Ordered set of source nodes of a path // Ordered set of source nodes of a path
std::vector<perm_string> src; std::vector<perm_string> src;
// Ordered set of destination nodes of a path // Ordered set of destination nodes of a path

View File

@ -4196,7 +4196,7 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const
/* A parallel connection does not support more than a one to one /* A parallel connection does not support more than a one to one
connection (source/destination). */ connection (source/destination). */
if (! full_flag && ((src.size() != 1) || (dst.size() != 1))) { if (! full_flag_ && ((src.size() != 1) || (dst.size() != 1))) {
/* To be compatible with NC-Verilog we allow a parallel connection /* To be compatible with NC-Verilog we allow a parallel connection
* with multiple sources/destinations if all the paths are only a * with multiple sources/destinations if all the paths are only a
* single bit wide (a scalar or a one bit vector). */ * single bit wide (a scalar or a one bit vector). */
@ -4324,7 +4324,7 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const
// For a parallel connection the source and destination // For a parallel connection the source and destination
// must be the same width. // must be the same width.
if (! full_flag) { if (! full_flag_) {
unsigned long src_wid = src_sig->vector_width(); unsigned long src_wid = src_sig->vector_width();
if (src_wid != dst_wid) { if (src_wid != dst_wid) {
cerr << get_fileline() << ": error: For a " cerr << get_fileline() << ": error: For a "

View File

@ -2344,10 +2344,8 @@ extern PSpecPath* pform_make_specify_path(const struct vlltype&li,
list<perm_string>*src, char pol, list<perm_string>*src, char pol,
bool full_flag, list<perm_string>*dst) bool full_flag, list<perm_string>*dst)
{ {
PSpecPath*path = new PSpecPath(src->size(), dst->size()); PSpecPath*path = new PSpecPath(src->size(), dst->size(), pol, full_flag);
FILE_NAME(path, li.text, li.first_line); FILE_NAME(path, li.text, li.first_line);
path->polarity = pol;
path->full_flag = full_flag;
unsigned idx; unsigned idx;
list<perm_string>::const_iterator cur; list<perm_string>::const_iterator cur;

View File

@ -945,8 +945,8 @@ void PSpecPath::dump(std::ostream&out, unsigned ind) const
} }
out << " "; out << " ";
if (polarity) out << polarity; if (polarity_) out << polarity_;
if (full_flag) out << "*> "; if (full_flag_) out << "*> ";
else out << "=> "; else out << "=> ";
if (data_source_expression) if (data_source_expression)