Fix for GitHub issue 26 - compiler crash when module port has no internal net.

The compiler correctly reports an error when a module port has no
associated internal net/reg, but could crash when the module was
instantiated.
This commit is contained in:
Martin Whitaker 2014-05-23 22:36:28 +01:00
parent ff72782ec6
commit d05abf5ca4
1 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2013 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2014 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -1307,6 +1307,10 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const
perm_string pname = peek_tail_name(mport[0]->path());
NetNet*tmp = instance[0]->find_signal(pname);
// Handle the error case where there is no internal
// signal connected to the port.
if (!tmp) continue;
assert(tmp);
if (tmp->port_type() == NetNet::PINPUT) {