Display a warning for a part select of an array.

It is illegal to perform a part select on an array. This patch
adds an error message instead of failing an assert.
This commit is contained in:
Cary R 2007-11-06 13:01:11 -08:00 committed by Stephen Williams
parent 2ea6692833
commit e39b3fea1f
1 changed files with 6 additions and 230 deletions

View File

@ -2433,6 +2433,12 @@ NetNet* PEIdent::elaborate_lnet_common_(Design*des, NetScope*scope,
ivl_assert(*this, !name_tail.index.empty());
const index_component_t&index_head = name_tail.index.front();
if (index_head.sel == index_component_t::SEL_PART) {
cerr << get_line() << ": error: cannot perform a part "
<< "select on array " << sig->name() << "." << endl;
des->errors += 1;
return 0;
}
ivl_assert(*this, index_head.sel == index_component_t::SEL_BIT);
NetExpr*tmp_ex = elab_and_eval(des, scope, index_head.msb, -1);
@ -3110,233 +3116,3 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
return sig;
}
/*
* $Log: elab_net.cc,v $
* Revision 1.207 2007/06/12 04:05:45 steve
* Put instantiated modules in the proper generated scope.
*
* Revision 1.206 2007/06/04 02:19:07 steve
* Handle bit/part select of array words in nets.
*
* Revision 1.205 2007/06/02 03:42:12 steve
* Properly evaluate scope path expressions.
*
* Revision 1.204 2007/05/24 04:07:11 steve
* Rework the heirarchical identifier parse syntax and pform
* to handle more general combinations of heirarch and bit selects.
*
* Revision 1.203 2007/04/18 01:40:49 steve
* Fix elaboration of multiply of two constants.
*
* Revision 1.202 2007/04/17 04:18:10 steve
* Support part select of array words in net contexts.
*
* Revision 1.201 2007/03/22 16:08:14 steve
* Spelling fixes from Larry
*
* Revision 1.200 2007/02/27 06:10:16 steve
* Better error message around repeat concatenation syntax.
*
* Revision 1.199 2007/02/26 19:49:48 steve
* Spelling fixes (larry doolittle)
*
* Revision 1.198 2007/02/05 01:42:31 steve
* Set some missing local flags.
*
* Revision 1.197 2007/02/01 19:06:06 steve
* Ternary output node is local.
*
* Revision 1.196 2007/02/01 03:14:33 steve
* Detect and report arrays without index in net contexts.
*
* Revision 1.195 2007/01/31 04:21:10 steve
* Add method to bind assertions to verilog source lines.
*
* Revision 1.194 2007/01/20 02:10:45 steve
* Get argument widths right for shift results.
*
* Revision 1.193 2007/01/19 04:26:24 steve
* Fix missing data_type mark for array words.
*
* Revision 1.192 2007/01/16 05:44:15 steve
* Major rework of array handling. Memories are replaced with the
* more general concept of arrays. The NetMemory and NetEMemory
* classes are removed from the ivl core program, and the IVL_LPM_RAM
* lpm type is removed from the ivl_target API.
*
* Revision 1.191 2006/12/08 03:43:26 steve
* Prevent name clash when processing parameter in net.
*
* Revision 1.190 2006/11/26 06:29:16 steve
* Fix nexus widths for direct link assign and ternary nets.
*
* Revision 1.189 2006/08/08 05:11:37 steve
* Handle 64bit delay constants.
*
* Revision 1.188 2006/06/20 05:06:47 steve
* Sign extend operands of signed addition.
*
* Revision 1.187 2006/06/18 04:15:50 steve
* Add support for system functions in continuous assignments.
*
* Revision 1.186 2006/06/02 04:48:50 steve
* Make elaborate_expr methods aware of the width that the context
* requires of it. In the process, fix sizing of the width of unary
* minus is context determined sizes.
*
* Revision 1.185 2006/05/19 04:44:55 steve
* Get self-determined unary - width right.
*
* Revision 1.184 2006/05/01 20:47:58 steve
* More explicit datatype setup.
*
* Revision 1.183 2006/04/30 05:17:48 steve
* Get the data type of part select results right.
*
* Revision 1.182 2006/04/28 05:09:51 steve
* Handle padding of MUX net results.
*
* Revision 1.181 2006/04/28 04:28:35 steve
* Allow concatenations as arguments to inout ports.
*
* Revision 1.180 2006/04/24 05:15:07 steve
* Fix support for indexed part select in continuous assign l-values.
*
* Revision 1.179 2006/04/10 00:32:14 steve
* Clean up index expression error message.
*
* Revision 1.178 2006/02/02 02:43:57 steve
* Allow part selects of memory words in l-values.
*
* Revision 1.177 2006/01/02 05:33:19 steve
* Node delays can be more general expressions in structural contexts.
*
* Revision 1.176 2005/10/11 16:15:52 steve
* Logical or/and return VT_LOGIC type.
*
* Revision 1.175 2005/09/19 15:21:09 steve
* Fix data type of parameters to logic.
*
* Revision 1.174 2005/09/15 23:04:09 steve
* Make sure div, mod and mult nodes have line number info.
*
* Revision 1.173 2005/09/14 15:15:44 steve
* fit type elaboration of logical not.
*
* Revision 1.172 2005/09/01 04:10:47 steve
* Check operand types for compatibility.
*
* Revision 1.171 2005/08/31 05:07:31 steve
* Handle memory references is continuous assignments.
*
* Revision 1.170 2005/08/06 17:58:16 steve
* Implement bi-directional part selects.
*
* Revision 1.169 2005/07/15 04:13:25 steve
* Match data type of PV select input/output.
*
* Revision 1.168 2005/07/15 00:42:02 steve
* Get output type correct for binary mux (ternary) expression.
*
* Revision 1.167 2005/07/11 16:56:50 steve
* Remove NetVariable and ivl_variable_t structures.
*
* Revision 1.166 2005/07/07 16:22:49 steve
* Generalize signals to carry types.
*
* Revision 1.165 2005/05/24 01:44:27 steve
* Do sign extension of structuran nets.
*
* Revision 1.164 2005/05/19 03:51:38 steve
* Make sure comparison widths match.
*
* Revision 1.163 2005/05/10 05:10:40 steve
* Make sig-eq-constant optimization more effective.
*
* Revision 1.162 2005/05/08 23:44:08 steve
* Add support for variable part select.
*
* Revision 1.161 2005/05/06 00:25:13 steve
* Handle synthesis of concatenation expressions.
*
* Revision 1.160 2005/04/08 04:52:31 steve
* Make clear that memory addresses are cannonical.
*
* Revision 1.159 2005/04/06 05:29:08 steve
* Rework NetRamDq and IVL_LPM_RAM nodes.
*
* Revision 1.158 2005/03/19 06:59:53 steve
* Handle wide operands to logical AND.
*
* Revision 1.157 2005/03/19 06:23:49 steve
* Handle LPM shifts.
*
* Revision 1.156 2005/03/18 02:56:03 steve
* Add support for LPM_UFUNC user defined functions.
*
* Revision 1.155 2005/03/13 01:26:48 steve
* UPdate elabrate continuous assighn of string to net.
*
* Revision 1.154 2005/03/12 06:43:35 steve
* Update support for LPM_MOD.
*
* Revision 1.153 2005/03/09 05:52:03 steve
* Handle case inequality in netlists.
*
* Revision 1.152 2005/02/19 02:43:38 steve
* Support shifts and divide.
*
* Revision 1.151 2005/02/12 06:25:40 steve
* Restructure NetMux devices to pass vectors.
* Generate NetMux devices from ternary expressions,
* Reduce NetMux devices to bufif when appropriate.
*
* Revision 1.150 2005/02/03 04:56:20 steve
* laborate reduction gates into LPM_RED_ nodes.
*
* Revision 1.149 2005/01/30 05:20:38 steve
* Elaborate unary subtract and NOT in netlist
* contexts, and concatenation too.
*
* Revision 1.148 2005/01/29 18:46:18 steve
* Netlist boolean expressions generate gate vectors.
*
* Revision 1.147 2005/01/29 16:46:22 steve
* Elaborate parameter reference to desired width without concats.
*
* Revision 1.146 2005/01/29 00:37:06 steve
* Integrate pr1072 fix from v0_8-branch.
*
* Revision 1.145 2005/01/28 05:39:33 steve
* Simplified NetMult and IVL_LPM_MULT.
*
* Revision 1.144 2005/01/22 18:16:00 steve
* Remove obsolete NetSubnet class.
*
* Revision 1.143 2005/01/22 01:06:55 steve
* Change case compare from logic to an LPM node.
*
* Revision 1.142 2005/01/16 04:20:32 steve
* Implement LPM_COMPARE nodes as two-input vector functors.
*
* Revision 1.141 2005/01/13 00:23:10 steve
* Fix elaboration of == compared to constants.
*
* Revision 1.140 2005/01/09 20:16:00 steve
* Use PartSelect/PV and VP to handle part selects through ports.
*
* Revision 1.139 2004/12/11 02:31:25 steve
* Rework of internals to carry vectors through nexus instead
* of single bits. Make the ivl, tgt-vvp and vvp initial changes
* down this path.
*
* Revision 1.138 2004/10/04 03:09:38 steve
* Fix excessive error message.
*
* Revision 1.137 2004/10/04 01:10:52 steve
* Clean up spurious trailing white space.
*
* Revision 1.136 2004/10/04 00:25:46 steve
* Error message to match assertion.
*/