2000-08-12 18:34:37 +02:00
|
|
|
/*
|
2018-10-06 21:13:31 +02:00
|
|
|
* Copyright (c) 2000-2018 Stephen Williams (steve@icarus.com)
|
2013-02-17 23:42:07 +01:00
|
|
|
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
|
2000-08-12 18:34:37 +02:00
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
* General Public License as published by the Free Software
|
|
|
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-08-29 03:41:23 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2000-08-12 18:34:37 +02:00
|
|
|
*/
|
|
|
|
|
|
2001-07-25 05:10:48 +02:00
|
|
|
# include "config.h"
|
|
|
|
|
|
|
|
|
|
# include <iostream>
|
|
|
|
|
|
2008-01-05 00:23:47 +01:00
|
|
|
# include <cstring>
|
2010-05-31 22:12:06 +02:00
|
|
|
# include <cstdio> // sprintf()
|
2000-08-20 06:13:56 +02:00
|
|
|
# include "compiler.h"
|
2000-09-18 03:24:32 +02:00
|
|
|
# include "t-dll.h"
|
2012-12-01 21:03:01 +01:00
|
|
|
# include "netclass.h"
|
2001-07-07 05:01:37 +02:00
|
|
|
# include "netmisc.h"
|
2008-11-24 06:29:54 +01:00
|
|
|
# include "discipline.h"
|
2010-05-31 22:12:06 +02:00
|
|
|
# include <cstdlib>
|
2008-06-30 03:46:46 +02:00
|
|
|
# include "ivl_assert.h"
|
2010-10-24 00:52:56 +02:00
|
|
|
# include "ivl_alloc.h"
|
2000-08-12 18:34:37 +02:00
|
|
|
|
2008-09-08 01:43:54 +02:00
|
|
|
struct dll_target dll_target_obj;
|
|
|
|
|
|
2001-05-20 17:09:39 +02:00
|
|
|
#if defined(__WIN32__)
|
|
|
|
|
|
|
|
|
|
inline ivl_dll_t ivl_dlopen(const char *name)
|
|
|
|
|
{
|
2002-11-05 03:12:35 +01:00
|
|
|
ivl_dll_t res = (ivl_dll_t) LoadLibrary(name);
|
|
|
|
|
return res;
|
2001-05-20 17:09:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline void * ivl_dlsym(ivl_dll_t dll, const char *nm)
|
|
|
|
|
{
|
2002-11-05 03:12:35 +01:00
|
|
|
return (void*)GetProcAddress((HMODULE)dll, nm);
|
2001-05-20 17:09:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void ivl_dlclose(ivl_dll_t dll)
|
|
|
|
|
{
|
2002-11-05 03:12:35 +01:00
|
|
|
FreeLibrary((HMODULE)dll);
|
2001-05-20 17:09:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *dlerror(void)
|
|
|
|
|
{
|
2002-11-05 03:12:35 +01:00
|
|
|
static char msg[256];
|
|
|
|
|
unsigned long err = GetLastError();
|
2004-10-04 03:10:51 +02:00
|
|
|
FormatMessage(
|
2001-05-20 17:09:39 +02:00
|
|
|
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
|
|
|
|
NULL,
|
2002-11-05 03:12:35 +01:00
|
|
|
err,
|
2001-05-20 17:09:39 +02:00
|
|
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
|
|
|
|
(LPTSTR) &msg,
|
2002-11-05 03:12:35 +01:00
|
|
|
sizeof(msg) - 1,
|
2004-10-04 03:10:51 +02:00
|
|
|
NULL
|
2001-05-20 17:09:39 +02:00
|
|
|
);
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
#elif defined(HAVE_DLFCN_H)
|
2000-12-15 06:45:25 +01:00
|
|
|
inline ivl_dll_t ivl_dlopen(const char*name)
|
2002-01-23 05:54:37 +01:00
|
|
|
{ return dlopen(name,RTLD_LAZY); }
|
2000-12-15 06:45:25 +01:00
|
|
|
|
|
|
|
|
inline void* ivl_dlsym(ivl_dll_t dll, const char*nm)
|
2003-12-12 06:43:08 +01:00
|
|
|
{
|
|
|
|
|
void*sym = dlsym(dll, nm);
|
|
|
|
|
/* Not found? try without the leading _ */
|
|
|
|
|
if (sym == 0 && nm[0] == '_')
|
|
|
|
|
sym = dlsym(dll, nm+1);
|
|
|
|
|
return sym;
|
|
|
|
|
}
|
2000-12-15 06:45:25 +01:00
|
|
|
|
|
|
|
|
inline void ivl_dlclose(ivl_dll_t dll)
|
|
|
|
|
{ dlclose(dll); }
|
|
|
|
|
|
|
|
|
|
#elif defined(HAVE_DL_H)
|
|
|
|
|
inline ivl_dll_t ivl_dlopen(const char*name)
|
|
|
|
|
{ return shl_load(name, BIND_IMMEDIATE, 0); }
|
|
|
|
|
|
|
|
|
|
inline void* ivl_dlsym(ivl_dll_t dll, const char*nm)
|
|
|
|
|
{
|
|
|
|
|
void*sym;
|
|
|
|
|
int rc = shl_findsym(&dll, nm, TYPE_PROCEDURE, &sym);
|
|
|
|
|
return (rc == 0) ? sym : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void ivl_dlclose(ivl_dll_t dll)
|
|
|
|
|
{ shl_unload(dll); }
|
2000-12-15 19:06:47 +01:00
|
|
|
|
|
|
|
|
inline const char*dlerror(void)
|
|
|
|
|
{ return strerror( errno ); }
|
2000-12-15 06:45:25 +01:00
|
|
|
#endif
|
|
|
|
|
|
2016-02-01 00:29:52 +01:00
|
|
|
ivl_scope_s::ivl_scope_s()
|
|
|
|
|
{
|
|
|
|
|
func_type = IVL_VT_NO_TYPE;
|
|
|
|
|
func_signed = false;
|
|
|
|
|
func_width = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-26 22:32:47 +02:00
|
|
|
/*
|
|
|
|
|
* The custom new operator for the ivl_nexus_s type allows us to
|
|
|
|
|
* allocate nexus objects in blocks. There are generally lots of them
|
|
|
|
|
* permanently allocated, and allocating them in blocks reduces the
|
|
|
|
|
* allocation overhead.
|
|
|
|
|
*/
|
|
|
|
|
|
2009-12-10 22:24:27 +01:00
|
|
|
template <class TYPE> void* pool_permalloc(size_t s)
|
2007-03-26 22:32:47 +02:00
|
|
|
{
|
2009-12-10 22:24:27 +01:00
|
|
|
static TYPE * pool_ptr = 0;
|
|
|
|
|
static int pool_remaining = 0;
|
|
|
|
|
static const size_t POOL_SIZE = 4096;
|
|
|
|
|
|
|
|
|
|
assert(s == sizeof(TYPE));
|
|
|
|
|
if (pool_remaining <= 0) {
|
|
|
|
|
pool_ptr = new TYPE[POOL_SIZE];
|
|
|
|
|
pool_remaining = POOL_SIZE;
|
2007-03-26 22:32:47 +02:00
|
|
|
}
|
|
|
|
|
|
2009-12-10 22:24:27 +01:00
|
|
|
TYPE*tmp = pool_ptr;
|
|
|
|
|
pool_ptr += 1;
|
|
|
|
|
pool_remaining -= 1;
|
2007-03-26 22:32:47 +02:00
|
|
|
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-10 22:24:27 +01:00
|
|
|
void* ivl_nexus_s::operator new(size_t s)
|
|
|
|
|
{
|
|
|
|
|
return pool_permalloc<struct ivl_nexus_s>(s);
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-10 06:42:12 +01:00
|
|
|
void ivl_nexus_s::operator delete(void*, size_t)
|
|
|
|
|
{
|
|
|
|
|
assert(0);
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-10 22:24:27 +01:00
|
|
|
void* ivl_net_const_s::operator new(size_t s)
|
|
|
|
|
{
|
|
|
|
|
return pool_permalloc<struct ivl_net_const_s>(s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ivl_net_const_s::operator delete(void*, size_t)
|
|
|
|
|
{
|
|
|
|
|
assert(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static StringHeapLex net_const_strings;
|
|
|
|
|
|
2007-06-02 05:42:12 +02:00
|
|
|
static perm_string make_scope_name(const hname_t&name)
|
|
|
|
|
{
|
2014-03-31 02:20:42 +02:00
|
|
|
if (! name.has_numbers())
|
2007-06-02 05:42:12 +02:00
|
|
|
return name.peek_name();
|
|
|
|
|
|
|
|
|
|
char buf[1024];
|
2014-03-31 02:20:42 +02:00
|
|
|
snprintf(buf, sizeof buf, "%s", name.peek_name().str());
|
|
|
|
|
|
|
|
|
|
char*cp = buf + strlen(buf);
|
|
|
|
|
size_t ncp = sizeof buf - (cp-buf);
|
|
|
|
|
|
|
|
|
|
for (size_t idx = 0 ; idx < name.has_numbers() ; idx += 1) {
|
|
|
|
|
int len = snprintf(cp, ncp, "[%d]", name.peek_number(idx));
|
|
|
|
|
cp += len;
|
|
|
|
|
ncp -= len;
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-02 05:42:12 +02:00
|
|
|
return lex_strings.make(buf);
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-06 04:15:43 +01:00
|
|
|
static void drive_from_link(const Link&lnk, ivl_drive_t&drv0, ivl_drive_t&drv1)
|
|
|
|
|
{
|
2010-03-16 23:16:53 +01:00
|
|
|
drv0 = lnk.drive0();
|
|
|
|
|
drv1 = lnk.drive1();
|
2002-01-06 04:15:43 +01:00
|
|
|
}
|
|
|
|
|
|
2002-05-26 03:39:02 +02:00
|
|
|
ivl_attribute_s* dll_target::fill_in_attributes(const Attrib*net)
|
2002-05-24 06:36:23 +02:00
|
|
|
{
|
|
|
|
|
ivl_attribute_s*attr;
|
2002-05-26 03:39:02 +02:00
|
|
|
unsigned nattr = net->attr_cnt();
|
2002-05-24 06:36:23 +02:00
|
|
|
|
|
|
|
|
if (nattr == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
attr = new struct ivl_attribute_s[nattr];
|
|
|
|
|
|
|
|
|
|
for (unsigned idx = 0 ; idx < nattr ; idx += 1) {
|
|
|
|
|
verinum tmp = net->attr_value(idx);
|
2004-02-20 19:53:33 +01:00
|
|
|
attr[idx].key = net->attr_key(idx);
|
2002-05-24 06:36:23 +02:00
|
|
|
if (tmp.is_string()) {
|
|
|
|
|
attr[idx].type = IVL_ATT_STR;
|
2002-08-04 21:13:16 +02:00
|
|
|
attr[idx].val.str = strings_.add(tmp.as_string().c_str());
|
2002-05-24 06:36:23 +02:00
|
|
|
|
|
|
|
|
} else if (tmp == verinum()) {
|
|
|
|
|
attr[idx].type = IVL_ATT_VOID;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
attr[idx].type = IVL_ATT_NUM;
|
|
|
|
|
attr[idx].val.num = tmp.as_long();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return attr;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-07 21:45:42 +02:00
|
|
|
/*
|
|
|
|
|
* This function locates an ivl_scope_t object that matches the
|
|
|
|
|
* NetScope object. The search works by looking for the parent scope,
|
|
|
|
|
* then scanning the parent scope for the NetScope object.
|
|
|
|
|
*/
|
2001-10-19 23:53:24 +02:00
|
|
|
static ivl_scope_t find_scope_from_root(ivl_scope_t root, const NetScope*cur)
|
2000-10-07 21:45:42 +02:00
|
|
|
{
|
|
|
|
|
if (const NetScope*par = cur->parent()) {
|
2009-12-10 22:24:27 +01:00
|
|
|
ivl_scope_t parent = find_scope_from_root(root, par);
|
2013-03-18 01:44:15 +01:00
|
|
|
if (parent == 0) {
|
2001-10-22 04:05:20 +02:00
|
|
|
return 0;
|
2013-03-18 01:44:15 +01:00
|
|
|
}
|
2001-10-19 23:53:24 +02:00
|
|
|
|
2009-12-10 22:24:27 +01:00
|
|
|
map<hname_t,ivl_scope_t>::iterator idx = parent->children.find(cur->fullname());
|
|
|
|
|
if (idx == parent->children.end())
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
return idx->second;
|
2000-10-07 21:45:42 +02:00
|
|
|
|
|
|
|
|
} else {
|
2009-12-10 22:24:27 +01:00
|
|
|
perm_string cur_name = make_scope_name(cur->fullname());
|
2007-06-02 05:42:12 +02:00
|
|
|
if (strcmp(root->name_, cur_name) == 0)
|
2001-10-19 23:53:24 +02:00
|
|
|
return root;
|
2000-10-07 21:45:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-19 23:53:24 +02:00
|
|
|
ivl_scope_t dll_target::find_scope(ivl_design_s &des, const NetScope*cur)
|
|
|
|
|
{
|
2002-01-19 20:02:08 +01:00
|
|
|
assert(cur);
|
|
|
|
|
|
2013-02-17 23:42:07 +01:00
|
|
|
// If the scope is a PACKAGE, then it is a special kind of
|
|
|
|
|
// root scope and it in the packages array instead.
|
|
|
|
|
if (cur->type() == NetScope::PACKAGE) {
|
|
|
|
|
perm_string cur_name = cur->module_name();
|
|
|
|
|
for (size_t idx = 0 ; idx < des.packages.size() ; idx += 1) {
|
2013-03-07 19:01:16 +01:00
|
|
|
if (des.packages[idx]->name_ == cur_name)
|
2013-02-17 23:42:07 +01:00
|
|
|
return des.packages[idx];
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-18 01:44:15 +01:00
|
|
|
if (cur->type() == NetScope::CLASS) {
|
|
|
|
|
ivl_scope_t tmp = des.classes[cur];
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (unsigned idx = 0; idx < des.roots.size(); idx += 1) {
|
|
|
|
|
assert(des.roots[idx]);
|
|
|
|
|
ivl_scope_t scope = find_scope_from_root(des.roots[idx], cur);
|
|
|
|
|
if (scope)
|
|
|
|
|
return scope;
|
2002-01-19 20:02:08 +01:00
|
|
|
}
|
2013-03-18 01:44:15 +01:00
|
|
|
|
2013-04-07 02:38:36 +02:00
|
|
|
for (size_t idx = 0; idx < des.packages.size(); idx += 1) {
|
|
|
|
|
assert(des.packages[idx]);
|
|
|
|
|
ivl_scope_t scope = find_scope_from_root(des.packages[idx], cur);
|
|
|
|
|
if (scope)
|
|
|
|
|
return scope;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-18 01:44:15 +01:00
|
|
|
for (map<const NetScope*,ivl_scope_t>::iterator idx = des.classes.begin()
|
|
|
|
|
; idx != des.classes.end() ; ++ idx) {
|
|
|
|
|
ivl_scope_t scope = find_scope_from_root(idx->second, cur);
|
|
|
|
|
if (scope)
|
|
|
|
|
return scope;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
2001-10-19 23:53:24 +02:00
|
|
|
}
|
|
|
|
|
|
2001-03-20 02:44:13 +01:00
|
|
|
ivl_scope_t dll_target::lookup_scope_(const NetScope*cur)
|
|
|
|
|
{
|
2001-10-19 23:53:24 +02:00
|
|
|
return find_scope(des_, cur);
|
2001-03-20 02:44:13 +01:00
|
|
|
}
|
|
|
|
|
|
2001-07-22 02:17:49 +02:00
|
|
|
/*
|
|
|
|
|
* This is a convenience function to locate an ivl_signal_t object
|
|
|
|
|
* given the NetESignal that has the signal name.
|
|
|
|
|
*/
|
2001-10-19 23:53:24 +02:00
|
|
|
ivl_signal_t dll_target::find_signal(ivl_design_s &des, const NetNet*net)
|
2001-07-22 02:17:49 +02:00
|
|
|
{
|
2001-10-19 23:53:24 +02:00
|
|
|
ivl_scope_t scope = find_scope(des, net->scope());
|
2001-07-22 02:17:49 +02:00
|
|
|
assert(scope);
|
|
|
|
|
|
2007-03-26 22:32:47 +02:00
|
|
|
perm_string nname = net->name();
|
2001-07-22 02:17:49 +02:00
|
|
|
|
2012-07-14 03:41:41 +02:00
|
|
|
for (unsigned idx = 0 ; idx < scope->sigs_.size() ; idx += 1) {
|
2001-07-22 02:17:49 +02:00
|
|
|
if (strcmp(scope->sigs_[idx]->name_, nname) == 0)
|
|
|
|
|
return scope->sigs_[idx];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert(0);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-08 06:01:54 +02:00
|
|
|
static ivl_nexus_t nexus_sig_make(ivl_signal_t net, unsigned pin)
|
|
|
|
|
{
|
|
|
|
|
ivl_nexus_t tmp = new struct ivl_nexus_s;
|
2008-11-10 06:42:12 +01:00
|
|
|
tmp->ptrs_.resize(1);
|
2001-04-30 01:17:38 +02:00
|
|
|
tmp->ptrs_[0].pin_ = pin;
|
|
|
|
|
tmp->ptrs_[0].type_ = __NEXUS_PTR_SIG;
|
|
|
|
|
tmp->ptrs_[0].l.sig = net;
|
2001-05-12 05:18:44 +02:00
|
|
|
|
|
|
|
|
ivl_drive_t drive = IVL_DR_HiZ;
|
|
|
|
|
switch (ivl_signal_type(net)) {
|
|
|
|
|
case IVL_SIT_REG:
|
|
|
|
|
drive = IVL_DR_STRONG;
|
|
|
|
|
break;
|
2003-07-05 22:42:08 +02:00
|
|
|
default:
|
|
|
|
|
break;
|
2001-05-12 05:18:44 +02:00
|
|
|
}
|
|
|
|
|
tmp->ptrs_[0].drive0 = drive;
|
|
|
|
|
tmp->ptrs_[0].drive1 = drive;
|
|
|
|
|
|
2000-10-08 06:01:54 +02:00
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void nexus_sig_add(ivl_nexus_t nex, ivl_signal_t net, unsigned pin)
|
|
|
|
|
{
|
2008-11-10 06:42:12 +01:00
|
|
|
unsigned top = nex->ptrs_.size();
|
|
|
|
|
nex->ptrs_.resize(top+1);
|
2001-05-12 05:18:44 +02:00
|
|
|
ivl_drive_t drive = IVL_DR_HiZ;
|
|
|
|
|
switch (ivl_signal_type(net)) {
|
|
|
|
|
case IVL_SIT_REG:
|
|
|
|
|
drive = IVL_DR_STRONG;
|
|
|
|
|
break;
|
2003-07-05 22:42:08 +02:00
|
|
|
default:
|
|
|
|
|
break;
|
2001-05-12 05:18:44 +02:00
|
|
|
}
|
|
|
|
|
|
2008-11-10 06:42:12 +01:00
|
|
|
nex->ptrs_[top].type_= __NEXUS_PTR_SIG;
|
|
|
|
|
nex->ptrs_[top].drive0 = drive;
|
|
|
|
|
nex->ptrs_[top].drive1 = drive;
|
|
|
|
|
nex->ptrs_[top].pin_ = pin;
|
|
|
|
|
nex->ptrs_[top].l.sig= net;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void nexus_bra_add(ivl_nexus_t nex, ivl_branch_t net, unsigned pin)
|
|
|
|
|
{
|
|
|
|
|
unsigned top = nex->ptrs_.size();
|
|
|
|
|
nex->ptrs_.resize(top+1);
|
|
|
|
|
nex->ptrs_[top].type_= __NEXUS_PTR_BRA;
|
|
|
|
|
nex->ptrs_[top].drive0 = 0;
|
|
|
|
|
nex->ptrs_[top].drive1 = 0;
|
|
|
|
|
nex->ptrs_[top].pin_ = pin;
|
|
|
|
|
nex->ptrs_[top].l.bra= net;
|
2000-10-08 06:01:54 +02:00
|
|
|
}
|
|
|
|
|
|
2003-07-26 06:06:58 +02:00
|
|
|
/*
|
|
|
|
|
* Add the pin of the logic object to the nexus, and return the nexus
|
|
|
|
|
* pointer used for the pin.
|
|
|
|
|
*
|
|
|
|
|
* NOTE: This pointer is only valid until another pin is added to the
|
|
|
|
|
* nexus.
|
|
|
|
|
*/
|
2001-12-14 03:05:13 +01:00
|
|
|
static ivl_nexus_ptr_t nexus_log_add(ivl_nexus_t nex,
|
|
|
|
|
ivl_net_logic_t net,
|
|
|
|
|
unsigned pin)
|
2000-10-08 06:01:54 +02:00
|
|
|
{
|
2008-11-10 06:42:12 +01:00
|
|
|
unsigned top = nex->ptrs_.size();
|
|
|
|
|
nex->ptrs_.resize(top+1);
|
2000-10-08 06:01:54 +02:00
|
|
|
|
2008-11-10 06:42:12 +01:00
|
|
|
nex->ptrs_[top].type_= __NEXUS_PTR_LOG;
|
|
|
|
|
nex->ptrs_[top].drive0 = (pin == 0)? IVL_DR_STRONG : IVL_DR_HiZ;
|
|
|
|
|
nex->ptrs_[top].drive1 = (pin == 0)? IVL_DR_STRONG : IVL_DR_HiZ;
|
|
|
|
|
nex->ptrs_[top].pin_ = pin;
|
|
|
|
|
nex->ptrs_[top].l.log= net;
|
2001-12-14 03:05:13 +01:00
|
|
|
|
2008-11-10 06:42:12 +01:00
|
|
|
return & (nex->ptrs_[top]);
|
2000-10-08 06:01:54 +02:00
|
|
|
}
|
|
|
|
|
|
2002-01-06 04:15:43 +01:00
|
|
|
static void nexus_con_add(ivl_nexus_t nex, ivl_net_const_t net, unsigned pin,
|
|
|
|
|
ivl_drive_t drive0, ivl_drive_t drive1)
|
2000-10-13 05:39:27 +02:00
|
|
|
{
|
2008-11-10 06:42:12 +01:00
|
|
|
unsigned top = nex->ptrs_.size();
|
|
|
|
|
nex->ptrs_.resize(top+1);
|
2000-10-13 05:39:27 +02:00
|
|
|
|
2008-11-10 06:42:12 +01:00
|
|
|
nex->ptrs_[top].type_= __NEXUS_PTR_CON;
|
|
|
|
|
nex->ptrs_[top].drive0 = drive0;
|
|
|
|
|
nex->ptrs_[top].drive1 = drive1;
|
|
|
|
|
nex->ptrs_[top].pin_ = pin;
|
|
|
|
|
nex->ptrs_[top].l.con= net;
|
2000-10-13 05:39:27 +02:00
|
|
|
}
|
|
|
|
|
|
2001-05-12 05:18:44 +02:00
|
|
|
static void nexus_lpm_add(ivl_nexus_t nex, ivl_lpm_t net, unsigned pin,
|
|
|
|
|
ivl_drive_t drive0, ivl_drive_t drive1)
|
2000-12-05 07:29:33 +01:00
|
|
|
{
|
2008-11-10 06:42:12 +01:00
|
|
|
unsigned top = nex->ptrs_.size();
|
|
|
|
|
nex->ptrs_.resize(top+1);
|
2000-12-05 07:29:33 +01:00
|
|
|
|
2008-11-10 06:42:12 +01:00
|
|
|
nex->ptrs_[top].type_= __NEXUS_PTR_LPM;
|
|
|
|
|
nex->ptrs_[top].drive0 = drive0;
|
2010-11-01 22:37:06 +01:00
|
|
|
nex->ptrs_[top].drive1 = drive1;
|
2008-11-10 06:42:12 +01:00
|
|
|
nex->ptrs_[top].pin_ = pin;
|
|
|
|
|
nex->ptrs_[top].l.lpm= net;
|
2000-12-05 07:29:33 +01:00
|
|
|
}
|
|
|
|
|
|
2008-05-24 05:53:10 +02:00
|
|
|
static void nexus_switch_add(ivl_nexus_t nex, ivl_switch_t net, unsigned pin)
|
|
|
|
|
{
|
2008-11-10 06:42:12 +01:00
|
|
|
unsigned top = nex->ptrs_.size();
|
|
|
|
|
nex->ptrs_.resize(top+1);
|
2008-05-24 05:53:10 +02:00
|
|
|
|
2008-11-10 06:42:12 +01:00
|
|
|
nex->ptrs_[top].type_= __NEXUS_PTR_SWI;
|
|
|
|
|
nex->ptrs_[top].drive0 = IVL_DR_HiZ;
|
|
|
|
|
nex->ptrs_[top].drive1 = IVL_DR_HiZ;
|
|
|
|
|
nex->ptrs_[top].pin_ = pin;
|
|
|
|
|
nex->ptrs_[top].l.swi= net;
|
2008-05-24 05:53:10 +02:00
|
|
|
}
|
2000-10-13 05:39:27 +02:00
|
|
|
|
2000-10-07 21:45:42 +02:00
|
|
|
void scope_add_logic(ivl_scope_t scope, ivl_net_logic_t net)
|
|
|
|
|
{
|
|
|
|
|
if (scope->nlog_ == 0) {
|
|
|
|
|
scope->nlog_ = 1;
|
|
|
|
|
scope->log_ = (ivl_net_logic_t*)malloc(sizeof(ivl_net_logic_t));
|
|
|
|
|
scope->log_[0] = net;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
scope->nlog_ += 1;
|
|
|
|
|
scope->log_ = (ivl_net_logic_t*)
|
|
|
|
|
realloc(scope->log_, scope->nlog_*sizeof(ivl_net_logic_t));
|
|
|
|
|
scope->log_[scope->nlog_-1] = net;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-28 08:07:39 +02:00
|
|
|
void scope_add_event(ivl_scope_t scope, ivl_event_t net)
|
|
|
|
|
{
|
|
|
|
|
if (scope->nevent_ == 0) {
|
|
|
|
|
scope->nevent_ = 1;
|
|
|
|
|
scope->event_ = (ivl_event_t*)malloc(sizeof(ivl_event_t));
|
|
|
|
|
scope->event_[0] = net;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
scope->nevent_ += 1;
|
|
|
|
|
scope->event_ = (ivl_event_t*)
|
|
|
|
|
realloc(scope->event_, scope->nevent_*sizeof(ivl_event_t));
|
|
|
|
|
scope->event_[scope->nevent_-1] = net;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2000-11-11 01:03:36 +01:00
|
|
|
static void scope_add_lpm(ivl_scope_t scope, ivl_lpm_t net)
|
|
|
|
|
{
|
|
|
|
|
if (scope->nlpm_ == 0) {
|
|
|
|
|
assert(scope->lpm_ == 0);
|
|
|
|
|
scope->nlpm_ = 1;
|
|
|
|
|
scope->lpm_ = (ivl_lpm_t*)malloc(sizeof(ivl_lpm_t));
|
|
|
|
|
scope->lpm_[0] = net;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
assert(scope->lpm_);
|
|
|
|
|
scope->nlpm_ += 1;
|
|
|
|
|
scope->lpm_ = (ivl_lpm_t*)
|
|
|
|
|
realloc(scope->lpm_,
|
|
|
|
|
scope->nlpm_*sizeof(ivl_lpm_t));
|
|
|
|
|
scope->lpm_[scope->nlpm_-1] = net;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-05-24 05:53:10 +02:00
|
|
|
static void scope_add_switch(ivl_scope_t scope, ivl_switch_t net)
|
|
|
|
|
{
|
|
|
|
|
scope->switches.push_back(net);
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-11 00:40:53 +01:00
|
|
|
ivl_parameter_t dll_target::scope_find_param(ivl_scope_t scope,
|
|
|
|
|
const char*name)
|
|
|
|
|
{
|
|
|
|
|
unsigned idx = 0;
|
2013-04-06 04:27:03 +02:00
|
|
|
while (idx < scope->param.size()) {
|
|
|
|
|
if (strcmp(name, scope->param[idx].basename) == 0)
|
|
|
|
|
return &scope->param[idx];
|
2003-03-11 00:40:53 +01:00
|
|
|
|
|
|
|
|
idx += 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This method scans the parameters of the scope, and makes
|
|
|
|
|
* ivl_parameter_t objects. This involves saving the name and scanning
|
|
|
|
|
* the expression value.
|
|
|
|
|
*/
|
2008-10-20 19:06:04 +02:00
|
|
|
void dll_target::make_scope_parameters(ivl_scope_t scop, const NetScope*net)
|
2003-03-11 00:40:53 +01:00
|
|
|
{
|
2013-09-09 22:32:55 +02:00
|
|
|
if (net->parameters.empty()) {
|
2013-04-06 04:27:03 +02:00
|
|
|
scop->param.clear();
|
2003-03-11 00:40:53 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-06 04:27:03 +02:00
|
|
|
scop->param.resize(net->parameters.size());
|
2003-03-11 00:40:53 +01:00
|
|
|
|
|
|
|
|
unsigned idx = 0;
|
2004-02-20 07:22:56 +01:00
|
|
|
typedef map<perm_string,NetScope::param_expr_t>::const_iterator pit_t;
|
2003-03-11 00:40:53 +01:00
|
|
|
|
|
|
|
|
for (pit_t cur_pit = net->parameters.begin()
|
2010-10-23 23:57:59 +02:00
|
|
|
; cur_pit != net->parameters.end() ; ++ cur_pit ) {
|
2003-03-11 00:40:53 +01:00
|
|
|
|
2013-04-06 04:27:03 +02:00
|
|
|
assert(idx < scop->param.size());
|
|
|
|
|
ivl_parameter_t cur_par = &scop->param[idx];
|
|
|
|
|
cur_par->basename = cur_pit->first;
|
2012-06-04 21:43:33 +02:00
|
|
|
cur_par->local = cur_pit->second.local_flag;
|
2013-07-04 20:26:39 +02:00
|
|
|
/* Either both the MSB and LSB expressions are provided or
|
|
|
|
|
* neither are provided. */
|
|
|
|
|
if (cur_pit->second.msb) {
|
|
|
|
|
assert(cur_pit->second.lsb);
|
|
|
|
|
/* The MSB and LSB expressions must be integral constants. */
|
|
|
|
|
const NetEConst *msbc =
|
|
|
|
|
dynamic_cast<const NetEConst*>(cur_pit->second.msb);
|
|
|
|
|
const NetEConst *lsbc =
|
|
|
|
|
dynamic_cast<const NetEConst*>(cur_pit->second.lsb);
|
|
|
|
|
assert(msbc);
|
|
|
|
|
assert(lsbc);
|
|
|
|
|
cur_par->msb = msbc->value().as_long();
|
|
|
|
|
cur_par->lsb = lsbc->value().as_long();
|
|
|
|
|
} else {
|
|
|
|
|
assert(! cur_pit->second.lsb);
|
|
|
|
|
cur_par->msb = cur_pit->second.val->expr_width() - 1;
|
|
|
|
|
assert(cur_par->msb >= 0);
|
|
|
|
|
cur_par->lsb = 0;
|
|
|
|
|
}
|
|
|
|
|
cur_par->signed_flag = cur_pit->second.signed_flag;
|
2008-10-20 19:06:04 +02:00
|
|
|
cur_par->scope = scop;
|
2013-04-06 04:27:03 +02:00
|
|
|
FILE_NAME(cur_par, &(cur_pit->second));
|
2003-03-11 00:40:53 +01:00
|
|
|
|
2013-04-06 04:27:03 +02:00
|
|
|
NetExpr*etmp = cur_pit->second.val;
|
|
|
|
|
if (etmp == 0) {
|
2013-07-04 20:26:39 +02:00
|
|
|
cerr << "?:?: internal error: What is the parameter "
|
|
|
|
|
<< "expression for " << cur_pit->first
|
2013-04-06 04:27:03 +02:00
|
|
|
<< " in " << net->fullname() << "?" << endl;
|
|
|
|
|
}
|
|
|
|
|
assert(etmp);
|
2007-06-02 05:42:12 +02:00
|
|
|
make_scope_param_expr(cur_par, etmp);
|
|
|
|
|
idx += 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-03-11 00:40:53 +01:00
|
|
|
|
2007-06-02 05:42:12 +02:00
|
|
|
void dll_target::make_scope_param_expr(ivl_parameter_t cur_par, NetExpr*etmp)
|
|
|
|
|
{
|
|
|
|
|
if (const NetEConst*e = dynamic_cast<const NetEConst*>(etmp)) {
|
2003-03-11 00:40:53 +01:00
|
|
|
|
2007-06-02 05:42:12 +02:00
|
|
|
expr_const(e);
|
|
|
|
|
assert(expr_);
|
2003-03-11 00:40:53 +01:00
|
|
|
|
2007-06-02 05:42:12 +02:00
|
|
|
switch (expr_->type_) {
|
|
|
|
|
case IVL_EX_STRING:
|
|
|
|
|
expr_->u_.string_.parameter = cur_par;
|
|
|
|
|
break;
|
|
|
|
|
case IVL_EX_NUMBER:
|
|
|
|
|
expr_->u_.number_.parameter = cur_par;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
assert(0);
|
2003-03-11 00:40:53 +01:00
|
|
|
}
|
|
|
|
|
|
2008-10-20 19:06:04 +02:00
|
|
|
} else if (const NetECReal*er = dynamic_cast<const NetECReal*>(etmp)) {
|
2007-06-02 05:42:12 +02:00
|
|
|
|
2008-10-20 19:06:04 +02:00
|
|
|
expr_creal(er);
|
2007-06-02 05:42:12 +02:00
|
|
|
assert(expr_);
|
|
|
|
|
assert(expr_->type_ == IVL_EX_REALNUM);
|
|
|
|
|
expr_->u_.real_.parameter = cur_par;
|
2003-03-11 00:40:53 +01:00
|
|
|
|
|
|
|
|
}
|
2007-06-02 05:42:12 +02:00
|
|
|
|
2008-06-30 03:46:46 +02:00
|
|
|
if (expr_ == 0) {
|
|
|
|
|
cerr << etmp->get_fileline() << ": internal error: "
|
|
|
|
|
<< "Parameter expression not reduced to constant? "
|
|
|
|
|
<< *etmp << endl;
|
|
|
|
|
}
|
|
|
|
|
ivl_assert(*etmp, expr_);
|
|
|
|
|
|
2007-06-02 05:42:12 +02:00
|
|
|
cur_par->value = expr_;
|
|
|
|
|
expr_ = 0;
|
2003-03-11 00:40:53 +01:00
|
|
|
}
|
|
|
|
|
|
2016-02-01 00:29:52 +01:00
|
|
|
static void fill_in_scope_function(ivl_scope_t scope, const NetScope*net)
|
|
|
|
|
{
|
|
|
|
|
scope->type_ = IVL_SCT_FUNCTION;
|
|
|
|
|
const NetFuncDef*def = net->func_def();
|
|
|
|
|
assert(def);
|
|
|
|
|
|
2019-11-07 23:25:51 +01:00
|
|
|
if (def->is_void()) {
|
2016-02-01 18:29:49 +01:00
|
|
|
// Special case: If there is no return signal, this is
|
|
|
|
|
// apparently a VOID function.
|
|
|
|
|
scope->func_type = IVL_VT_VOID;
|
|
|
|
|
scope->func_signed = 0;
|
|
|
|
|
scope->func_width = 0;
|
|
|
|
|
} else {
|
2019-11-07 23:25:51 +01:00
|
|
|
const NetNet*return_sig = def->return_sig();
|
2016-02-01 18:29:49 +01:00
|
|
|
scope->func_type = return_sig->data_type();
|
|
|
|
|
scope->func_signed = return_sig->get_signed();
|
|
|
|
|
scope->func_width = return_sig->vector_width();
|
|
|
|
|
}
|
2016-02-01 00:29:52 +01:00
|
|
|
|
|
|
|
|
scope->tname_ = def->scope()->basename();
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-18 01:44:15 +01:00
|
|
|
void dll_target::add_root(const NetScope *s)
|
2001-10-19 23:53:24 +02:00
|
|
|
{
|
|
|
|
|
ivl_scope_t root_ = new struct ivl_scope_s;
|
2004-02-18 18:11:54 +01:00
|
|
|
perm_string name = s->basename();
|
2003-03-03 03:22:41 +01:00
|
|
|
root_->name_ = name;
|
2008-04-30 03:58:25 +02:00
|
|
|
FILE_NAME(root_, s);
|
2001-10-19 23:53:24 +02:00
|
|
|
root_->parent = 0;
|
|
|
|
|
root_->nlog_ = 0;
|
|
|
|
|
root_->log_ = 0;
|
|
|
|
|
root_->nevent_ = 0;
|
|
|
|
|
root_->event_ = 0;
|
|
|
|
|
root_->nlpm_ = 0;
|
|
|
|
|
root_->lpm_ = 0;
|
2007-01-29 02:52:51 +01:00
|
|
|
root_->def = 0;
|
2003-03-11 00:40:53 +01:00
|
|
|
make_scope_parameters(root_, s);
|
2014-10-02 23:09:27 +02:00
|
|
|
root_->tname_ = root_->name_;
|
|
|
|
|
root_->time_precision = s->time_precision();
|
|
|
|
|
root_->time_units = s->time_unit();
|
|
|
|
|
root_->nattr = s->attr_cnt();
|
|
|
|
|
root_->attr = fill_in_attributes(s);
|
|
|
|
|
root_->is_auto = 0;
|
|
|
|
|
root_->is_cell = s->is_cell();
|
2013-03-18 01:44:15 +01:00
|
|
|
switch (s->type()) {
|
|
|
|
|
case NetScope::PACKAGE:
|
|
|
|
|
root_->type_ = IVL_SCT_PACKAGE;
|
|
|
|
|
break;
|
|
|
|
|
case NetScope::MODULE:
|
|
|
|
|
root_->type_ = IVL_SCT_MODULE;
|
|
|
|
|
break;
|
|
|
|
|
case NetScope::CLASS:
|
|
|
|
|
root_->type_ = IVL_SCT_CLASS;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
assert(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (s->type()) {
|
|
|
|
|
case NetScope::MODULE:
|
2013-02-17 23:42:07 +01:00
|
|
|
root_->ports = s->module_port_nets();
|
|
|
|
|
if (root_->ports > 0) {
|
|
|
|
|
root_->u_.net = new NetNet*[root_->ports];
|
|
|
|
|
for (unsigned idx = 0; idx < root_->ports; idx += 1) {
|
|
|
|
|
root_->u_.net[idx] = s->module_port_net(idx);
|
|
|
|
|
}
|
2011-03-07 20:18:23 +01:00
|
|
|
}
|
2013-02-17 23:42:07 +01:00
|
|
|
root_->module_ports_info = s->module_port_info();
|
2002-12-21 01:55:57 +01:00
|
|
|
|
2013-03-18 01:44:15 +01:00
|
|
|
des_.roots.push_back(root_);
|
|
|
|
|
break;
|
2013-02-17 23:42:07 +01:00
|
|
|
|
2013-03-18 01:44:15 +01:00
|
|
|
case NetScope::PACKAGE:
|
2013-02-17 23:42:07 +01:00
|
|
|
root_->ports = 0;
|
2013-03-18 01:44:15 +01:00
|
|
|
des_.packages.push_back(root_);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NetScope::CLASS:
|
|
|
|
|
root_->ports = 0;
|
|
|
|
|
des_.classes[s] = root_;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
assert(0);
|
|
|
|
|
break;
|
2013-02-17 23:42:07 +01:00
|
|
|
}
|
2001-10-19 23:53:24 +02:00
|
|
|
}
|
|
|
|
|
|
2000-08-12 18:34:37 +02:00
|
|
|
bool dll_target::start_design(const Design*des)
|
|
|
|
|
{
|
2003-11-10 21:59:03 +01:00
|
|
|
const char*dll_path_ = des->get_flag("DLL");
|
2003-11-13 06:55:33 +01:00
|
|
|
|
2003-11-10 21:59:03 +01:00
|
|
|
dll_ = ivl_dlopen(dll_path_);
|
2003-11-13 06:55:33 +01:00
|
|
|
|
|
|
|
|
if ((dll_ == 0) && (dll_path_[0] != '/')) {
|
|
|
|
|
size_t len = strlen(basedir) + 1 + strlen(dll_path_) + 1;
|
|
|
|
|
char*tmp = new char[len];
|
|
|
|
|
sprintf(tmp, "%s/%s", basedir, dll_path_);
|
|
|
|
|
dll_ = ivl_dlopen(tmp);
|
|
|
|
|
delete[]tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-12 18:34:37 +02:00
|
|
|
if (dll_ == 0) {
|
2002-11-03 21:47:23 +01:00
|
|
|
cerr << "error: " << dll_path_ << " failed to load." << endl;
|
2000-08-14 06:39:56 +02:00
|
|
|
cerr << dll_path_ << ": " << dlerror() << endl;
|
2000-08-12 18:34:37 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-18 03:24:32 +02:00
|
|
|
stmt_cur_ = 0;
|
|
|
|
|
|
2000-09-30 04:18:15 +02:00
|
|
|
// Initialize the design object.
|
|
|
|
|
des_.self = des;
|
2001-07-01 01:03:16 +02:00
|
|
|
des_.time_precision = des->get_precision();
|
2000-08-12 18:34:37 +02:00
|
|
|
|
2008-11-24 06:29:54 +01:00
|
|
|
des_.disciplines.resize(disciplines.size());
|
|
|
|
|
unsigned idx = 0;
|
|
|
|
|
for (map<perm_string,ivl_discipline_t>::const_iterator cur = disciplines.begin()
|
2010-10-23 23:57:59 +02:00
|
|
|
; cur != disciplines.end() ; ++ cur ) {
|
2008-11-24 06:29:54 +01:00
|
|
|
des_.disciplines[idx] = cur->second;
|
|
|
|
|
idx += 1;
|
|
|
|
|
}
|
|
|
|
|
assert(idx == des_.disciplines.size());
|
|
|
|
|
|
2017-10-21 16:04:25 +02:00
|
|
|
list<NetScope *> scope_list;
|
2014-10-02 23:09:27 +02:00
|
|
|
|
|
|
|
|
scope_list = des->find_package_scopes();
|
|
|
|
|
for (list<NetScope*>::const_iterator cur = scope_list.begin()
|
|
|
|
|
; cur != scope_list.end(); ++ cur ) {
|
|
|
|
|
add_root(*cur);
|
2013-02-17 23:42:07 +01:00
|
|
|
}
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2014-10-02 23:09:27 +02:00
|
|
|
scope_list = des->find_root_scopes();
|
|
|
|
|
for (list<NetScope*>::const_iterator cur = scope_list.begin()
|
|
|
|
|
; cur != scope_list.end(); ++ cur ) {
|
|
|
|
|
add_root(*cur);
|
2013-02-17 23:42:07 +01:00
|
|
|
}
|
2001-09-01 03:57:31 +02:00
|
|
|
|
2000-12-15 06:45:25 +01:00
|
|
|
target_ = (target_design_f)ivl_dlsym(dll_, LU "target_design" TU);
|
2000-10-21 18:49:45 +02:00
|
|
|
if (target_ == 0) {
|
|
|
|
|
cerr << dll_path_ << ": error: target_design entry "
|
|
|
|
|
"point is missing." << endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2000-08-14 06:39:56 +02:00
|
|
|
|
2000-08-12 18:34:37 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-08 06:01:54 +02:00
|
|
|
/*
|
|
|
|
|
* Here ivl is telling us that the design is scanned completely, and
|
|
|
|
|
* here is where we call the API to process the constructed design.
|
|
|
|
|
*/
|
2001-03-27 05:31:06 +02:00
|
|
|
int dll_target::end_design(const Design*)
|
2000-08-12 18:34:37 +02:00
|
|
|
{
|
2013-11-17 01:27:05 +01:00
|
|
|
int rc;
|
|
|
|
|
if (errors == 0) {
|
|
|
|
|
if (verbose_flag) {
|
|
|
|
|
cout << " ... invoking target_design" << endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rc = (target_)(&des_);
|
|
|
|
|
} else {
|
|
|
|
|
if (verbose_flag) {
|
|
|
|
|
cout << " ... skipping target_design due to errors." << endl;
|
|
|
|
|
}
|
|
|
|
|
rc = errors;
|
2002-07-24 18:21:52 +02:00
|
|
|
}
|
|
|
|
|
|
2000-12-15 06:45:25 +01:00
|
|
|
ivl_dlclose(dll_);
|
2001-03-27 05:31:06 +02:00
|
|
|
return rc;
|
2000-08-12 18:34:37 +02:00
|
|
|
}
|
|
|
|
|
|
2008-05-24 05:53:10 +02:00
|
|
|
void dll_target::switch_attributes(struct ivl_switch_s *obj,
|
|
|
|
|
const NetNode*net)
|
|
|
|
|
{
|
|
|
|
|
obj->nattr = net->attr_cnt();
|
|
|
|
|
obj->attr = fill_in_attributes(net);
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-04 21:13:16 +02:00
|
|
|
void dll_target::logic_attributes(struct ivl_net_logic_s *obj,
|
|
|
|
|
const NetNode*net)
|
2001-10-11 02:13:19 +02:00
|
|
|
{
|
2002-05-26 03:39:02 +02:00
|
|
|
obj->nattr = net->attr_cnt();
|
2002-08-04 21:13:16 +02:00
|
|
|
obj->attr = fill_in_attributes(net);
|
2001-10-11 02:13:19 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-13 01:04:22 +02:00
|
|
|
void dll_target::make_delays_(ivl_expr_t*delay, const NetObj*net)
|
2006-01-02 06:33:19 +01:00
|
|
|
{
|
2010-07-13 01:04:22 +02:00
|
|
|
delay[0] = 0;
|
|
|
|
|
delay[1] = 0;
|
|
|
|
|
delay[2] = 0;
|
2006-01-02 06:33:19 +01:00
|
|
|
|
|
|
|
|
/* Translate delay expressions to ivl_target form. Try to
|
|
|
|
|
preserve pointer equality, not as a rule but to save on
|
|
|
|
|
expression trees. */
|
|
|
|
|
if (net->rise_time()) {
|
|
|
|
|
expr_ = 0;
|
|
|
|
|
net->rise_time()->expr_scan(this);
|
2010-07-13 01:04:22 +02:00
|
|
|
delay[0] = expr_;
|
2006-01-02 06:33:19 +01:00
|
|
|
expr_ = 0;
|
|
|
|
|
}
|
|
|
|
|
if (net->fall_time()) {
|
|
|
|
|
if (net->fall_time() == net->rise_time()) {
|
2010-07-13 01:04:22 +02:00
|
|
|
delay[1] = delay[0];
|
2006-01-02 06:33:19 +01:00
|
|
|
} else {
|
|
|
|
|
expr_ = 0;
|
|
|
|
|
net->fall_time()->expr_scan(this);
|
2010-07-13 01:04:22 +02:00
|
|
|
delay[1] = expr_;
|
2006-01-02 06:33:19 +01:00
|
|
|
expr_ = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (net->decay_time()) {
|
|
|
|
|
if (net->decay_time() == net->rise_time()) {
|
2010-07-13 01:04:22 +02:00
|
|
|
delay[2] = delay[0];
|
2006-01-02 06:33:19 +01:00
|
|
|
} else {
|
|
|
|
|
expr_ = 0;
|
|
|
|
|
net->decay_time()->expr_scan(this);
|
2010-07-13 01:04:22 +02:00
|
|
|
delay[2] = expr_;
|
2006-01-02 06:33:19 +01:00
|
|
|
expr_ = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-13 01:04:22 +02:00
|
|
|
void dll_target::make_logic_delays_(struct ivl_net_logic_s*obj,
|
|
|
|
|
const NetObj*net)
|
|
|
|
|
{
|
|
|
|
|
make_delays_(obj->delay, net);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void dll_target::make_switch_delays_(struct ivl_switch_s*obj,
|
|
|
|
|
const NetObj*net)
|
|
|
|
|
{
|
|
|
|
|
make_delays_(obj->delay, net);
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
void dll_target::make_lpm_delays_(struct ivl_lpm_s*obj,
|
|
|
|
|
const NetObj*net)
|
|
|
|
|
{
|
2010-07-13 01:04:22 +02:00
|
|
|
make_delays_(obj->delay, net);
|
2008-01-21 20:13:28 +01:00
|
|
|
}
|
|
|
|
|
|
2008-02-14 03:10:12 +01:00
|
|
|
void dll_target::make_const_delays_(struct ivl_net_const_s*obj,
|
|
|
|
|
const NetObj*net)
|
|
|
|
|
{
|
2010-07-13 01:04:22 +02:00
|
|
|
make_delays_(obj->delay, net);
|
2008-02-14 03:10:12 +01:00
|
|
|
}
|
|
|
|
|
|
2008-11-10 06:42:12 +01:00
|
|
|
bool dll_target::branch(const NetBranch*net)
|
|
|
|
|
{
|
2008-11-12 05:41:14 +01:00
|
|
|
struct ivl_branch_s*obj = net->target_obj();
|
2008-11-10 06:42:12 +01:00
|
|
|
ivl_assert(*net, net->pin_count() == 2);
|
|
|
|
|
|
|
|
|
|
assert(net->pin(0).nexus()->t_cookie());
|
|
|
|
|
obj->pins[0] = net->pin(0).nexus()->t_cookie();
|
|
|
|
|
nexus_bra_add(obj->pins[0], obj, 0);
|
|
|
|
|
|
|
|
|
|
assert(net->pin(1).nexus()->t_cookie());
|
|
|
|
|
obj->pins[1] = net->pin(1).nexus()->t_cookie();
|
|
|
|
|
nexus_bra_add(obj->pins[1], obj, 1);
|
|
|
|
|
|
2008-11-25 07:00:33 +01:00
|
|
|
obj->island = net->get_island();
|
|
|
|
|
|
2008-11-10 06:42:12 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-08 06:01:54 +02:00
|
|
|
/*
|
|
|
|
|
* Add a bufz object to the scope that contains it.
|
|
|
|
|
*
|
|
|
|
|
* Note that in the ivl_target API a BUFZ device is a special kind of
|
|
|
|
|
* ivl_net_logic_t device, so create an ivl_net_logic_t cookie to
|
|
|
|
|
* handle it.
|
|
|
|
|
*/
|
2000-08-14 06:39:56 +02:00
|
|
|
bool dll_target::bufz(const NetBUFZ*net)
|
|
|
|
|
{
|
2000-10-07 21:45:42 +02:00
|
|
|
struct ivl_net_logic_s *obj = new struct ivl_net_logic_s;
|
|
|
|
|
|
|
|
|
|
assert(net->pin_count() == 2);
|
|
|
|
|
|
2010-07-12 02:16:15 +02:00
|
|
|
obj->type_ = net->transparent()? IVL_LO_BUFT : IVL_LO_BUFZ;
|
2004-12-11 03:31:25 +01:00
|
|
|
obj->width_= net->width();
|
2011-03-22 18:58:18 +01:00
|
|
|
obj->is_cassign = 0;
|
2004-12-11 03:31:25 +01:00
|
|
|
obj->npins_= 2;
|
2000-10-07 21:45:42 +02:00
|
|
|
obj->pins_ = new ivl_nexus_t[2];
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2000-10-07 21:45:42 +02:00
|
|
|
|
2000-10-08 06:01:54 +02:00
|
|
|
/* Get the ivl_nexus_t objects connected to the two pins.
|
|
|
|
|
|
|
|
|
|
(We know a priori that the ivl_nexus_t objects have been
|
|
|
|
|
allocated, because the signals have been scanned before
|
|
|
|
|
me. This saves me the trouble of allocating them.) */
|
|
|
|
|
|
2000-10-07 21:45:42 +02:00
|
|
|
assert(net->pin(0).nexus()->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->pins_[0] = net->pin(0).nexus()->t_cookie();
|
2002-01-12 05:03:09 +01:00
|
|
|
ivl_nexus_ptr_t out_ptr = nexus_log_add(obj->pins_[0], obj, 0);
|
2000-10-07 21:45:42 +02:00
|
|
|
|
2010-03-16 23:16:53 +01:00
|
|
|
out_ptr->drive0 = net->pin(0).drive0();
|
|
|
|
|
out_ptr->drive1 = net->pin(0).drive1();
|
2002-01-12 05:03:09 +01:00
|
|
|
|
2003-07-26 06:06:58 +02:00
|
|
|
assert(net->pin(1).nexus()->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->pins_[1] = net->pin(1).nexus()->t_cookie();
|
2003-07-26 06:06:58 +02:00
|
|
|
nexus_log_add(obj->pins_[1], obj, 1);
|
|
|
|
|
|
2000-10-08 06:01:54 +02:00
|
|
|
/* Attach the logic device to the scope that contains it. */
|
2000-10-07 21:45:42 +02:00
|
|
|
|
|
|
|
|
assert(net->scope());
|
2008-10-20 19:06:04 +02:00
|
|
|
ivl_scope_t scop = find_scope(des_, net->scope());
|
|
|
|
|
assert(scop);
|
2000-10-07 21:45:42 +02:00
|
|
|
|
2008-10-20 19:06:04 +02:00
|
|
|
obj->scope_ = scop;
|
2001-10-11 02:13:19 +02:00
|
|
|
|
2003-03-06 01:28:41 +01:00
|
|
|
obj->name_ = net->name();
|
2001-10-11 02:13:19 +02:00
|
|
|
logic_attributes(obj, net);
|
|
|
|
|
|
2006-01-02 06:33:19 +01:00
|
|
|
make_logic_delays_(obj, net);
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2008-10-20 19:06:04 +02:00
|
|
|
scope_add_logic(scop, obj);
|
2000-10-07 21:45:42 +02:00
|
|
|
|
|
|
|
|
return true;
|
2000-08-14 06:39:56 +02:00
|
|
|
}
|
|
|
|
|
|
2012-12-01 21:03:01 +01:00
|
|
|
bool dll_target::class_type(const NetScope*in_scope, netclass_t*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_scope_t use_scope = find_scope(des_, in_scope);
|
|
|
|
|
use_scope->classes.push_back(net);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-21 00:09:32 +01:00
|
|
|
bool dll_target::enumeration(const NetScope*in_scope, netenum_t*net)
|
|
|
|
|
{
|
2012-12-01 21:03:01 +01:00
|
|
|
ivl_scope_t use_scope = find_scope(des_, in_scope);
|
|
|
|
|
use_scope->enumerations_.push_back(net);
|
2010-11-21 00:09:32 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-19 20:12:42 +02:00
|
|
|
void dll_target::event(const NetEvent*net)
|
|
|
|
|
{
|
2001-03-28 08:07:39 +02:00
|
|
|
struct ivl_event_s *obj = new struct ivl_event_s;
|
|
|
|
|
|
2011-02-10 06:03:08 +01:00
|
|
|
FILE_NAME(obj, net);
|
|
|
|
|
|
2008-10-20 19:06:04 +02:00
|
|
|
ivl_scope_t scop = find_scope(des_, net->scope());
|
2003-03-06 02:24:37 +01:00
|
|
|
obj->name = net->name();
|
2008-10-20 19:06:04 +02:00
|
|
|
obj->scope = scop;
|
|
|
|
|
scope_add_event(scop, obj);
|
2001-03-28 08:07:39 +02:00
|
|
|
|
2001-04-01 03:48:21 +02:00
|
|
|
obj->nany = 0;
|
|
|
|
|
obj->nneg = 0;
|
|
|
|
|
obj->npos = 0;
|
|
|
|
|
|
|
|
|
|
if (net->nprobe() >= 1) {
|
|
|
|
|
|
|
|
|
|
for (unsigned idx = 0 ; idx < net->nprobe() ; idx += 1) {
|
2001-05-03 03:52:45 +02:00
|
|
|
const NetEvProbe*pr = net->probe(idx);
|
2001-04-01 03:48:21 +02:00
|
|
|
switch (pr->edge()) {
|
|
|
|
|
case NetEvProbe::ANYEDGE:
|
|
|
|
|
obj->nany += pr->pin_count();
|
|
|
|
|
break;
|
|
|
|
|
case NetEvProbe::NEGEDGE:
|
|
|
|
|
obj->nneg += pr->pin_count();
|
|
|
|
|
break;
|
|
|
|
|
case NetEvProbe::POSEDGE:
|
|
|
|
|
obj->npos += pr->pin_count();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2001-03-28 08:07:39 +02:00
|
|
|
}
|
|
|
|
|
|
2001-04-01 03:48:21 +02:00
|
|
|
unsigned npins = obj->nany + obj->nneg + obj->npos;
|
|
|
|
|
obj->pins = (ivl_nexus_t*)calloc(npins, sizeof(ivl_nexus_t));
|
2001-03-30 08:10:15 +02:00
|
|
|
|
2001-03-28 08:07:39 +02:00
|
|
|
} else {
|
|
|
|
|
obj->pins = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-19 20:12:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void dll_target::logic(const NetLogic*net)
|
|
|
|
|
{
|
2000-10-07 01:46:50 +02:00
|
|
|
struct ivl_net_logic_s *obj = new struct ivl_net_logic_s;
|
|
|
|
|
|
2004-12-11 03:31:25 +01:00
|
|
|
obj->width_ = net->width();
|
|
|
|
|
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
|
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
switch (net->type()) {
|
|
|
|
|
case NetLogic::AND:
|
|
|
|
|
obj->type_ = IVL_LO_AND;
|
|
|
|
|
break;
|
|
|
|
|
case NetLogic::BUF:
|
|
|
|
|
obj->type_ = IVL_LO_BUF;
|
|
|
|
|
break;
|
2000-12-05 07:29:33 +01:00
|
|
|
case NetLogic::BUFIF0:
|
|
|
|
|
obj->type_ = IVL_LO_BUFIF0;
|
|
|
|
|
break;
|
|
|
|
|
case NetLogic::BUFIF1:
|
|
|
|
|
obj->type_ = IVL_LO_BUFIF1;
|
|
|
|
|
break;
|
2007-09-07 03:46:22 +02:00
|
|
|
case NetLogic::CMOS:
|
|
|
|
|
obj->type_ = IVL_LO_CMOS;
|
|
|
|
|
break;
|
2000-12-15 00:23:07 +01:00
|
|
|
case NetLogic::NAND:
|
|
|
|
|
obj->type_ = IVL_LO_NAND;
|
|
|
|
|
break;
|
2001-01-15 23:08:32 +01:00
|
|
|
case NetLogic::NMOS:
|
|
|
|
|
obj->type_ = IVL_LO_NMOS;
|
|
|
|
|
break;
|
2000-12-15 00:23:07 +01:00
|
|
|
case NetLogic::NOR:
|
|
|
|
|
obj->type_ = IVL_LO_NOR;
|
|
|
|
|
break;
|
2001-01-15 23:08:32 +01:00
|
|
|
case NetLogic::NOT:
|
|
|
|
|
obj->type_ = IVL_LO_NOT;
|
|
|
|
|
break;
|
|
|
|
|
case NetLogic::NOTIF0:
|
|
|
|
|
obj->type_ = IVL_LO_NOTIF0;
|
|
|
|
|
break;
|
|
|
|
|
case NetLogic::NOTIF1:
|
|
|
|
|
obj->type_ = IVL_LO_NOTIF1;
|
|
|
|
|
break;
|
2000-10-07 01:46:50 +02:00
|
|
|
case NetLogic::OR:
|
|
|
|
|
obj->type_ = IVL_LO_OR;
|
|
|
|
|
break;
|
2001-04-29 22:19:10 +02:00
|
|
|
case NetLogic::PULLDOWN:
|
|
|
|
|
obj->type_ = IVL_LO_PULLDOWN;
|
|
|
|
|
break;
|
|
|
|
|
case NetLogic::PULLUP:
|
|
|
|
|
obj->type_ = IVL_LO_PULLUP;
|
|
|
|
|
break;
|
2007-09-07 03:46:22 +02:00
|
|
|
case NetLogic::RCMOS:
|
|
|
|
|
obj->type_ = IVL_LO_RCMOS;
|
|
|
|
|
break;
|
2001-01-15 23:08:32 +01:00
|
|
|
case NetLogic::RNMOS:
|
|
|
|
|
obj->type_ = IVL_LO_RNMOS;
|
|
|
|
|
break;
|
|
|
|
|
case NetLogic::RPMOS:
|
|
|
|
|
obj->type_ = IVL_LO_RPMOS;
|
|
|
|
|
break;
|
|
|
|
|
case NetLogic::PMOS:
|
|
|
|
|
obj->type_ = IVL_LO_PMOS;
|
|
|
|
|
break;
|
2000-12-15 00:23:07 +01:00
|
|
|
case NetLogic::XNOR:
|
|
|
|
|
obj->type_ = IVL_LO_XNOR;
|
|
|
|
|
break;
|
2000-10-07 01:46:50 +02:00
|
|
|
case NetLogic::XOR:
|
|
|
|
|
obj->type_ = IVL_LO_XOR;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
assert(0);
|
|
|
|
|
obj->type_ = IVL_LO_NONE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2011-03-22 18:58:18 +01:00
|
|
|
/* Some of the logical gates are used to represent operators in a
|
|
|
|
|
* continuous assignment, so set a flag if that is the case. */
|
|
|
|
|
obj->is_cassign = net->is_cassign();
|
2000-10-07 01:46:50 +02:00
|
|
|
|
2000-10-08 06:01:54 +02:00
|
|
|
/* Connect all the ivl_nexus_t objects to the pins of the
|
|
|
|
|
device. */
|
|
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
obj->npins_ = net->pin_count();
|
|
|
|
|
obj->pins_ = new ivl_nexus_t[obj->npins_];
|
2001-12-14 03:05:13 +01:00
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
for (unsigned idx = 0 ; idx < obj->npins_ ; idx += 1) {
|
|
|
|
|
const Nexus*nex = net->pin(idx).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->pins_[idx] = nex->t_cookie();
|
2001-12-14 03:05:13 +01:00
|
|
|
ivl_nexus_ptr_t tmp = nexus_log_add(obj->pins_[idx], obj, idx);
|
2015-04-25 20:50:00 +02:00
|
|
|
if (idx == 0) {
|
|
|
|
|
tmp->drive0 = net->pin(0).drive0();
|
|
|
|
|
tmp->drive1 = net->pin(0).drive1();
|
|
|
|
|
}
|
2001-12-14 03:05:13 +01:00
|
|
|
}
|
|
|
|
|
|
2000-10-07 21:45:42 +02:00
|
|
|
assert(net->scope());
|
2008-10-20 19:06:04 +02:00
|
|
|
ivl_scope_t scop = find_scope(des_, net->scope());
|
|
|
|
|
assert(scop);
|
2000-10-07 21:45:42 +02:00
|
|
|
|
2008-10-20 19:06:04 +02:00
|
|
|
obj->scope_= scop;
|
2003-03-06 01:28:41 +01:00
|
|
|
obj->name_ = net->name();
|
2000-08-19 20:12:42 +02:00
|
|
|
|
2001-10-11 02:13:19 +02:00
|
|
|
logic_attributes(obj, net);
|
2001-09-17 00:19:42 +02:00
|
|
|
|
2006-01-02 06:33:19 +01:00
|
|
|
make_logic_delays_(obj, net);
|
2001-12-06 04:11:00 +01:00
|
|
|
|
2008-10-20 19:06:04 +02:00
|
|
|
scope_add_logic(scop, obj);
|
2000-08-19 20:12:42 +02:00
|
|
|
}
|
|
|
|
|
|
2008-05-20 06:42:52 +02:00
|
|
|
bool dll_target::tran(const NetTran*net)
|
|
|
|
|
{
|
2008-05-24 05:53:10 +02:00
|
|
|
struct ivl_switch_s*obj = new struct ivl_switch_s;
|
|
|
|
|
obj->type = net->type();
|
2012-01-02 19:14:20 +01:00
|
|
|
obj->width = net->vector_width();
|
2008-06-03 20:16:25 +02:00
|
|
|
obj->part = 0;
|
|
|
|
|
obj->offset = 0;
|
2008-05-24 05:53:10 +02:00
|
|
|
obj->name = net->name();
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
2008-11-10 00:32:50 +01:00
|
|
|
obj->island = net->get_island();
|
2008-05-24 05:53:10 +02:00
|
|
|
assert(obj->scope);
|
2008-06-02 04:45:12 +02:00
|
|
|
assert(obj->island);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2008-05-24 05:53:10 +02:00
|
|
|
|
|
|
|
|
const Nexus*nex;
|
|
|
|
|
|
|
|
|
|
nex = net->pin(0).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
obj->pins[0] = nex->t_cookie();
|
|
|
|
|
|
|
|
|
|
nex = net->pin(1).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
obj->pins[1] = nex->t_cookie();
|
|
|
|
|
|
|
|
|
|
nexus_switch_add(obj->pins[0], obj, 0);
|
|
|
|
|
nexus_switch_add(obj->pins[1], obj, 1);
|
|
|
|
|
|
|
|
|
|
if (net->pin_count() > 2) {
|
|
|
|
|
nex = net->pin(2).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
obj->pins[2] = nex->t_cookie();
|
|
|
|
|
nexus_switch_add(obj->pins[2], obj, 2);
|
|
|
|
|
} else {
|
|
|
|
|
obj->pins[2] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-03 20:16:25 +02:00
|
|
|
if (obj->type == IVL_SW_TRAN_VP) {
|
|
|
|
|
obj->part = net->part_width();
|
|
|
|
|
obj->offset= net->part_offset();
|
|
|
|
|
}
|
|
|
|
|
|
2008-05-24 05:53:10 +02:00
|
|
|
switch_attributes(obj, net);
|
2010-07-13 01:04:22 +02:00
|
|
|
make_switch_delays_(obj, net);
|
2008-05-24 05:53:10 +02:00
|
|
|
scope_add_switch(obj->scope, obj);
|
|
|
|
|
|
|
|
|
|
return true;
|
2008-05-20 06:42:52 +02:00
|
|
|
}
|
|
|
|
|
|
2014-07-14 03:09:13 +02:00
|
|
|
bool dll_target::substitute(const NetSubstitute*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_SUBSTITUTE;
|
|
|
|
|
obj->name = net->name();
|
|
|
|
|
assert(net->scope());
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
|
|
|
|
FILE_NAME(obj, net);
|
|
|
|
|
|
|
|
|
|
obj->width = net->width();
|
|
|
|
|
obj->u_.substitute.base = net->base();
|
|
|
|
|
|
|
|
|
|
obj->u_.substitute.q = net->pin(0).nexus()->t_cookie();
|
|
|
|
|
obj->u_.substitute.a = net->pin(1).nexus()->t_cookie();
|
|
|
|
|
obj->u_.substitute.s = net->pin(2).nexus()->t_cookie();
|
|
|
|
|
nexus_lpm_add(obj->u_.substitute.q, obj, 0, IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
nexus_lpm_add(obj->u_.substitute.a, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
nexus_lpm_add(obj->u_.substitute.s, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
|
|
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-24 03:44:27 +02:00
|
|
|
bool dll_target::sign_extend(const NetSignExtend*net)
|
|
|
|
|
{
|
|
|
|
|
struct ivl_lpm_s*obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_SIGN_EXT;
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = net->width();
|
2005-05-24 03:44:27 +02:00
|
|
|
obj->name = net->name();
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2005-05-24 03:44:27 +02:00
|
|
|
|
|
|
|
|
const Nexus*nex;
|
|
|
|
|
|
|
|
|
|
nex = net->pin(0).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.reduce.q = nex->t_cookie();
|
2005-05-24 03:44:27 +02:00
|
|
|
nexus_lpm_add(obj->u_.reduce.q, obj, 0, IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
|
|
|
|
|
nex = net->pin(1).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.reduce.a = nex->t_cookie();
|
2005-05-24 03:44:27 +02:00
|
|
|
nexus_lpm_add(obj->u_.reduce.a, obj, 1, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
2005-05-24 03:44:27 +02:00
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-03 05:56:20 +01:00
|
|
|
bool dll_target::ureduce(const NetUReduce*net)
|
|
|
|
|
{
|
|
|
|
|
struct ivl_lpm_s*obj = new struct ivl_lpm_s;
|
|
|
|
|
switch (net->type()) {
|
|
|
|
|
case NetUReduce::NONE:
|
|
|
|
|
assert(0);
|
2011-10-13 04:03:09 +02:00
|
|
|
delete obj;
|
2005-02-03 05:56:20 +01:00
|
|
|
return false;
|
|
|
|
|
case NetUReduce::AND:
|
|
|
|
|
obj->type = IVL_LPM_RE_AND;
|
|
|
|
|
break;
|
|
|
|
|
case NetUReduce::OR:
|
|
|
|
|
obj->type = IVL_LPM_RE_OR;
|
|
|
|
|
break;
|
|
|
|
|
case NetUReduce::XOR:
|
|
|
|
|
obj->type = IVL_LPM_RE_XOR;
|
|
|
|
|
break;
|
|
|
|
|
case NetUReduce::NAND:
|
|
|
|
|
obj->type = IVL_LPM_RE_NAND;
|
|
|
|
|
break;
|
|
|
|
|
case NetUReduce::NOR:
|
|
|
|
|
obj->type = IVL_LPM_RE_NOR;
|
|
|
|
|
break;
|
|
|
|
|
case NetUReduce::XNOR:
|
|
|
|
|
obj->type = IVL_LPM_RE_XNOR;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
obj->name = net->name();
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2005-02-03 05:56:20 +01:00
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = net->width();
|
2005-02-03 05:56:20 +01:00
|
|
|
|
|
|
|
|
const Nexus*nex;
|
|
|
|
|
|
|
|
|
|
nex = net->pin(0).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.reduce.q = nex->t_cookie();
|
2005-02-03 05:56:20 +01:00
|
|
|
nexus_lpm_add(obj->u_.reduce.q, obj, 0, IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
|
|
|
|
|
nex = net->pin(1).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.reduce.a = nex->t_cookie();
|
2005-02-03 05:56:20 +01:00
|
|
|
nexus_lpm_add(obj->u_.reduce.a, obj, 1, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
2005-02-03 05:56:20 +01:00
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-19 05:01:10 +02:00
|
|
|
void dll_target::net_case_cmp(const NetCaseCmp*net)
|
|
|
|
|
{
|
2005-01-22 02:06:55 +01:00
|
|
|
struct ivl_lpm_s*obj = new struct ivl_lpm_s;
|
2014-06-14 03:01:41 +02:00
|
|
|
switch (net->kind()) {
|
|
|
|
|
case NetCaseCmp::EEQ:
|
|
|
|
|
obj->type = IVL_LPM_CMP_EEQ;
|
|
|
|
|
break;
|
|
|
|
|
case NetCaseCmp::NEQ:
|
|
|
|
|
obj->type = IVL_LPM_CMP_NEE;
|
|
|
|
|
break;
|
2017-11-18 04:32:09 +01:00
|
|
|
case NetCaseCmp::WEQ:
|
|
|
|
|
obj->type = IVL_LPM_CMP_WEQ;
|
|
|
|
|
break;
|
|
|
|
|
case NetCaseCmp::WNE:
|
|
|
|
|
obj->type = IVL_LPM_CMP_WNE;
|
|
|
|
|
break;
|
2014-06-14 03:01:41 +02:00
|
|
|
case NetCaseCmp::XEQ:
|
|
|
|
|
obj->type = IVL_LPM_CMP_EQX;
|
|
|
|
|
break;
|
|
|
|
|
case NetCaseCmp::ZEQ:
|
|
|
|
|
obj->type = IVL_LPM_CMP_EQZ;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2005-01-22 02:06:55 +01:00
|
|
|
obj->name = net->name();
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2001-06-19 05:01:10 +02:00
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = net->width();
|
2005-01-22 02:06:55 +01:00
|
|
|
obj->u_.arith.signed_flag = 0;
|
2001-06-19 05:01:10 +02:00
|
|
|
|
2005-01-22 02:06:55 +01:00
|
|
|
const Nexus*nex;
|
2001-06-19 05:01:10 +02:00
|
|
|
|
2005-01-22 02:06:55 +01:00
|
|
|
nex = net->pin(1).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2001-06-19 05:01:10 +02:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.a = nex->t_cookie();
|
2005-01-22 02:06:55 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.a, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2001-06-19 05:01:10 +02:00
|
|
|
|
2005-01-22 02:06:55 +01:00
|
|
|
nex = net->pin(2).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2001-06-19 05:01:10 +02:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.b = nex->t_cookie();
|
2005-01-22 02:06:55 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.b, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2002-07-22 23:07:40 +02:00
|
|
|
|
2005-01-22 02:06:55 +01:00
|
|
|
nex = net->pin(0).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.q = nex->t_cookie();
|
2005-01-22 02:06:55 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.q, obj, 0, IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
2005-01-22 02:06:55 +01:00
|
|
|
scope_add_lpm(obj->scope, obj);
|
2001-06-19 05:01:10 +02:00
|
|
|
}
|
|
|
|
|
|
2008-12-22 22:48:34 +01:00
|
|
|
ivl_event_t dll_target::make_lpm_trigger(const NetEvWait*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_event_t trigger = 0;
|
|
|
|
|
if (net) {
|
|
|
|
|
const NetEvent*ev = net->event(0);
|
|
|
|
|
|
|
|
|
|
/* Locate the event by name. */
|
|
|
|
|
ivl_scope_t ev_scope = lookup_scope_(ev->scope());
|
|
|
|
|
|
|
|
|
|
assert(ev_scope);
|
|
|
|
|
assert(ev_scope->nevent_ > 0);
|
|
|
|
|
for (unsigned idx = 0; idx < ev_scope->nevent_; idx += 1) {
|
|
|
|
|
const char*ename =
|
|
|
|
|
ivl_event_basename(ev_scope->event_[idx]);
|
|
|
|
|
if (strcmp(ev->name(), ename) == 0) {
|
|
|
|
|
trigger = ev_scope->event_[idx];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Connect up the probe pins. This wasn't done during the
|
|
|
|
|
::event method because the signals weren't scanned yet. */
|
|
|
|
|
assert(ev->nprobe() == 1);
|
|
|
|
|
const NetEvProbe*pr = ev->probe(0);
|
|
|
|
|
for (unsigned bit = 0; bit < pr->pin_count(); bit += 1) {
|
|
|
|
|
ivl_nexus_t nex = (ivl_nexus_t)
|
|
|
|
|
pr->pin(bit).nexus()->t_cookie();
|
|
|
|
|
assert(nex);
|
|
|
|
|
trigger->pins[bit] = nex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return trigger;
|
|
|
|
|
}
|
|
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
bool dll_target::net_sysfunction(const NetSysFunc*net)
|
|
|
|
|
{
|
|
|
|
|
unsigned idx;
|
|
|
|
|
const Nexus*nex;
|
|
|
|
|
|
|
|
|
|
struct ivl_lpm_s*obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_SFUNC;
|
|
|
|
|
obj->name = net->name();
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2006-06-18 06:15:50 +02:00
|
|
|
|
|
|
|
|
obj->u_.sfunc.ports = net->pin_count();
|
|
|
|
|
|
|
|
|
|
assert(net->pin_count() >= 1);
|
|
|
|
|
obj->width = net->vector_width();
|
|
|
|
|
|
|
|
|
|
obj->u_.sfunc.fun_name = net->func_name();
|
|
|
|
|
|
|
|
|
|
obj->u_.sfunc.pins = new ivl_nexus_t[net->pin_count()];
|
|
|
|
|
|
|
|
|
|
nex = net->pin(0).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.sfunc.pins[0] = nex->t_cookie();
|
2006-06-18 06:15:50 +02:00
|
|
|
nexus_lpm_add(obj->u_.sfunc.pins[0], obj, 0,
|
|
|
|
|
IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
|
|
|
|
|
for (idx = 1 ; idx < net->pin_count() ; idx += 1) {
|
|
|
|
|
nex = net->pin(idx).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.sfunc.pins[idx] = nex->t_cookie();
|
2006-06-18 06:15:50 +02:00
|
|
|
nexus_lpm_add(obj->u_.sfunc.pins[idx], obj, 0,
|
|
|
|
|
IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-22 22:48:34 +01:00
|
|
|
/* Save information about the trigger event if it exists. */
|
|
|
|
|
obj->u_.sfunc.trigger = make_lpm_trigger(net->trigger());
|
|
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-09 03:10:22 +01:00
|
|
|
/*
|
|
|
|
|
* An IVL_LPM_UFUNC represents a node in a combinational expression
|
|
|
|
|
* that calls a user defined function. I create an LPM object that has
|
|
|
|
|
* the right connections, and refers to the ivl_scope_t of the
|
|
|
|
|
* definition.
|
|
|
|
|
*/
|
|
|
|
|
bool dll_target::net_function(const NetUserFunc*net)
|
|
|
|
|
{
|
|
|
|
|
struct ivl_lpm_s*obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_UFUNC;
|
2003-03-06 01:28:41 +01:00
|
|
|
obj->name = net->name();
|
2002-03-09 03:10:22 +01:00
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2002-03-09 03:10:22 +01:00
|
|
|
|
|
|
|
|
/* Get the definition of the function and save it. */
|
|
|
|
|
const NetScope*def = net->def();
|
|
|
|
|
assert(def);
|
|
|
|
|
|
|
|
|
|
obj->u_.ufunc.def = lookup_scope_(def);
|
|
|
|
|
|
|
|
|
|
/* Save information about the ports in the ivl_lpm_s
|
|
|
|
|
structure. Note that port 0 is the return value. */
|
2005-03-18 03:56:03 +01:00
|
|
|
obj->u_.ufunc.ports = net->pin_count();
|
|
|
|
|
|
|
|
|
|
assert(net->pin_count() >= 1);
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = net->port_width(0);
|
2002-03-09 03:10:22 +01:00
|
|
|
|
|
|
|
|
/* Now collect all the pins and connect them to the nexa of
|
|
|
|
|
the net. The output pins have strong drive, and the
|
|
|
|
|
remaining input pins are HiZ. */
|
|
|
|
|
|
2005-03-18 03:56:03 +01:00
|
|
|
obj->u_.ufunc.pins = new ivl_nexus_t[net->pin_count()];
|
2002-03-09 03:10:22 +01:00
|
|
|
|
2005-03-18 03:56:03 +01:00
|
|
|
for (unsigned idx = 0 ; idx < net->pin_count() ; idx += 1) {
|
2002-03-09 03:10:22 +01:00
|
|
|
const Nexus*nex = net->pin(idx).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
ivl_nexus_t nn = nex->t_cookie();
|
2002-03-09 03:10:22 +01:00
|
|
|
assert(nn);
|
|
|
|
|
|
|
|
|
|
obj->u_.ufunc.pins[idx] = nn;
|
2005-03-18 03:56:03 +01:00
|
|
|
ivl_drive_t drive = idx == 0 ? IVL_DR_STRONG : IVL_DR_HiZ;
|
2002-03-09 03:10:22 +01:00
|
|
|
nexus_lpm_add(obj->u_.ufunc.pins[idx], obj, idx, drive, drive);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-22 22:48:34 +01:00
|
|
|
/* Save information about the trigger event if it exists. */
|
|
|
|
|
obj->u_.ufunc.trigger = make_lpm_trigger(net->trigger());
|
|
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
2002-03-09 03:10:22 +01:00
|
|
|
/* All done. Add this LPM to the scope. */
|
|
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-23 01:09:45 +02:00
|
|
|
void dll_target::udp(const NetUDP*net)
|
|
|
|
|
{
|
|
|
|
|
struct ivl_net_logic_s *obj = new struct ivl_net_logic_s;
|
|
|
|
|
|
|
|
|
|
obj->type_ = IVL_LO_UDP;
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2001-04-23 01:09:45 +02:00
|
|
|
|
2005-04-01 08:04:30 +02:00
|
|
|
/* The NetUDP class hasn't learned about width yet, so we
|
|
|
|
|
assume a width of 1. */
|
|
|
|
|
obj->width_ = 1;
|
2011-03-22 18:58:18 +01:00
|
|
|
obj->is_cassign = 0;
|
2005-04-01 08:04:30 +02:00
|
|
|
|
2004-02-18 18:11:54 +01:00
|
|
|
static map<perm_string,ivl_udp_t> udps;
|
2001-04-24 04:23:58 +02:00
|
|
|
ivl_udp_t u;
|
2001-04-23 01:09:45 +02:00
|
|
|
|
2011-02-20 19:57:27 +01:00
|
|
|
if (udps.find(net->udp_name()) != udps.end()) {
|
|
|
|
|
u = udps[net->udp_name()];
|
|
|
|
|
} else {
|
|
|
|
|
u = new struct ivl_udp_s;
|
|
|
|
|
u->nrows = net->rows();
|
|
|
|
|
u->table = (ivl_udp_s::ccharp_t*)malloc((u->nrows+1)*sizeof(char*));
|
|
|
|
|
u->table[u->nrows] = 0x0;
|
|
|
|
|
u->nin = net->nin();
|
|
|
|
|
u->sequ = net->is_sequential();
|
|
|
|
|
u->file = net->udp_file();
|
|
|
|
|
u->lineno = net->udp_lineno();
|
|
|
|
|
if (u->sequ) u->init = net->get_initial();
|
|
|
|
|
else u->init = 'x';
|
|
|
|
|
u->name = net->udp_name();
|
|
|
|
|
string inp;
|
|
|
|
|
char out;
|
|
|
|
|
unsigned int i = 0;
|
|
|
|
|
if (net->first(inp, out)) do {
|
|
|
|
|
string tt = inp+out;
|
|
|
|
|
u->table[i++] = strings_.add(tt.c_str());
|
|
|
|
|
} while (net->next(inp, out));
|
|
|
|
|
assert(i==u->nrows);
|
|
|
|
|
assert((u->nin + 1) == net->port_count());
|
|
|
|
|
u->ports = new string [u->nin + 1];
|
|
|
|
|
for(unsigned idx = 0; idx <= u->nin; idx += 1) {
|
|
|
|
|
u->ports[idx] = net->port_name(idx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
udps[net->udp_name()] = u;
|
|
|
|
|
}
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2001-04-23 01:09:45 +02:00
|
|
|
obj->udp = u;
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2001-04-23 01:09:45 +02:00
|
|
|
// Some duplication of code here, see: dll_target::logic()
|
|
|
|
|
|
|
|
|
|
/* Connect all the ivl_nexus_t objects to the pins of the
|
|
|
|
|
device. */
|
|
|
|
|
|
|
|
|
|
obj->npins_ = net->pin_count();
|
|
|
|
|
obj->pins_ = new ivl_nexus_t[obj->npins_];
|
|
|
|
|
for (unsigned idx = 0 ; idx < obj->npins_ ; idx += 1) {
|
2003-05-13 03:56:15 +02:00
|
|
|
/* Skip unconnected input pins. These will take on HiZ
|
|
|
|
|
values by the code generators. */
|
2009-01-08 07:07:08 +01:00
|
|
|
if (! net->pin(idx).is_linked()) {
|
2003-05-13 18:30:39 +02:00
|
|
|
obj->pins_[idx] = 0;
|
2003-05-13 03:56:15 +02:00
|
|
|
continue;
|
2003-05-13 18:30:39 +02:00
|
|
|
}
|
2003-05-13 03:56:15 +02:00
|
|
|
|
2009-01-08 07:07:08 +01:00
|
|
|
const Nexus*nex = net->pin(idx).nexus();
|
|
|
|
|
ivl_assert(*net, nex && nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->pins_[idx] = nex->t_cookie();
|
2001-04-23 01:09:45 +02:00
|
|
|
nexus_log_add(obj->pins_[idx], obj, idx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert(net->scope());
|
2008-10-20 19:06:04 +02:00
|
|
|
ivl_scope_t scop = find_scope(des_, net->scope());
|
|
|
|
|
assert(scop);
|
2001-04-23 01:09:45 +02:00
|
|
|
|
2008-10-20 19:06:04 +02:00
|
|
|
obj->scope_= scop;
|
2003-03-06 01:28:41 +01:00
|
|
|
obj->name_ = net->name();
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2001-04-23 01:09:45 +02:00
|
|
|
|
2006-01-02 06:33:19 +01:00
|
|
|
make_logic_delays_(obj, net);
|
2001-12-06 04:11:00 +01:00
|
|
|
|
2005-06-26 20:08:46 +02:00
|
|
|
obj->nattr = 0;
|
|
|
|
|
obj->attr = 0;
|
|
|
|
|
|
2008-10-20 19:06:04 +02:00
|
|
|
scope_add_logic(scop, obj);
|
2001-04-23 01:09:45 +02:00
|
|
|
}
|
|
|
|
|
|
2008-05-06 07:00:39 +02:00
|
|
|
void dll_target::lpm_abs(const NetAbs*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_ABS;
|
|
|
|
|
obj->name = net->name(); // NetAddSub names are permallocated.
|
|
|
|
|
assert(net->scope());
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2008-05-06 07:00:39 +02:00
|
|
|
|
|
|
|
|
obj->u_.arith.signed_flag = 0;
|
|
|
|
|
obj->width = net->width();
|
|
|
|
|
|
|
|
|
|
const Nexus*nex;
|
|
|
|
|
/* the output is pin(0) */
|
|
|
|
|
nex = net->pin(0).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
|
|
|
|
obj->u_.arith.q = nex->t_cookie();
|
|
|
|
|
nexus_lpm_add(obj->u_.arith.q, obj, 0, IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
|
2008-05-07 05:37:00 +02:00
|
|
|
nex = net->pin(1).nexus();
|
2008-05-06 07:00:39 +02:00
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
|
|
|
|
/* pin(1) is the input data. */
|
|
|
|
|
obj->u_.arith.a = nex->t_cookie();
|
|
|
|
|
nexus_lpm_add(obj->u_.arith.a, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
|
|
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
|
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-07 04:12:43 +02:00
|
|
|
void dll_target::lpm_add_sub(const NetAddSub*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
2004-02-20 19:53:33 +01:00
|
|
|
if (net->attribute(perm_string::literal("LPM_Direction")) == verinum("SUB"))
|
2001-06-07 05:09:37 +02:00
|
|
|
obj->type = IVL_LPM_SUB;
|
|
|
|
|
else
|
|
|
|
|
obj->type = IVL_LPM_ADD;
|
2003-03-06 01:28:41 +01:00
|
|
|
obj->name = net->name(); // NetAddSub names are permallocated.
|
2001-06-07 04:12:43 +02:00
|
|
|
assert(net->scope());
|
2001-10-19 23:53:24 +02:00
|
|
|
obj->scope = find_scope(des_, net->scope());
|
2001-06-07 04:12:43 +02:00
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2001-06-07 04:12:43 +02:00
|
|
|
|
2003-04-11 07:18:08 +02:00
|
|
|
obj->u_.arith.signed_flag = 0;
|
|
|
|
|
|
2001-06-07 06:20:10 +02:00
|
|
|
/* Choose the width of the adder. If the carry bit is
|
|
|
|
|
connected, then widen the adder by one and plan on leaving
|
|
|
|
|
the fake inputs unconnected. */
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = net->width();
|
2001-06-07 06:20:10 +02:00
|
|
|
if (net->pin_Cout().is_linked()) {
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width += 1;
|
2001-06-07 06:20:10 +02:00
|
|
|
}
|
2001-06-07 04:12:43 +02:00
|
|
|
|
|
|
|
|
|
2004-12-11 03:31:25 +01:00
|
|
|
const Nexus*nex;
|
2001-06-07 04:12:43 +02:00
|
|
|
|
2004-12-11 03:31:25 +01:00
|
|
|
nex = net->pin_Result().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2001-06-07 04:12:43 +02:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.q = nex->t_cookie();
|
2004-12-11 03:31:25 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.q, obj, 0, IVL_DR_STRONG, IVL_DR_STRONG);
|
2001-06-07 04:12:43 +02:00
|
|
|
|
2004-12-11 03:31:25 +01:00
|
|
|
nex = net->pin_DataA().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2001-06-07 04:12:43 +02:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.a = nex->t_cookie();
|
2004-12-11 03:31:25 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.a, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2001-06-07 04:12:43 +02:00
|
|
|
|
2004-12-11 03:31:25 +01:00
|
|
|
nex = net->pin_DataB().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2001-06-07 04:12:43 +02:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.b = nex->t_cookie();
|
2004-12-11 03:31:25 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.b, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2001-06-07 04:12:43 +02:00
|
|
|
|
2001-06-07 06:20:10 +02:00
|
|
|
/* If the carry output is connected, then connect the extra Q
|
|
|
|
|
pin to the carry nexus and zero the a and b inputs. */
|
|
|
|
|
if (net->pin_Cout().is_linked()) {
|
2004-12-11 03:31:25 +01:00
|
|
|
cerr << "XXXX: t-dll.cc: Forgot how to connect cout." << endl;
|
2001-06-07 06:20:10 +02:00
|
|
|
}
|
|
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
2001-06-07 04:12:43 +02:00
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-16 06:44:14 +01:00
|
|
|
bool dll_target::lpm_array_dq(const NetArrayDq*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_ARRAY;
|
|
|
|
|
obj->name = net->name();
|
|
|
|
|
obj->u_.array.sig = find_signal(des_, net->mem());
|
|
|
|
|
assert(obj->u_.array.sig);
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2007-01-16 06:44:14 +01:00
|
|
|
obj->width = net->width();
|
|
|
|
|
obj->u_.array.swid = net->awidth();
|
|
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
2007-01-16 06:44:14 +01:00
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
|
|
|
|
|
const Nexus*nex;
|
|
|
|
|
|
|
|
|
|
nex = net->pin_Address().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.array.a = nex->t_cookie();
|
2007-01-16 06:44:14 +01:00
|
|
|
nexus_lpm_add(obj->u_.array.a, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
|
|
|
|
|
nex = net->pin_Result().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.array.q = nex->t_cookie();
|
2007-01-16 06:44:14 +01:00
|
|
|
nexus_lpm_add(obj->u_.array.q, obj, 0, IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2001-07-07 05:01:37 +02:00
|
|
|
/*
|
|
|
|
|
* The lpm_clshift device represents both left and right shifts,
|
|
|
|
|
* depending on what is connected to the Direction pin. We convert
|
|
|
|
|
* this device into SHIFTL or SHIFTR devices.
|
|
|
|
|
*/
|
2001-07-05 00:59:25 +02:00
|
|
|
void dll_target::lpm_clshift(const NetCLShift*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_SHIFTL;
|
2003-03-06 01:28:41 +01:00
|
|
|
obj->name = net->name();
|
2001-07-05 00:59:25 +02:00
|
|
|
assert(net->scope());
|
2001-10-19 23:53:24 +02:00
|
|
|
obj->scope = find_scope(des_, net->scope());
|
2001-07-05 00:59:25 +02:00
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2001-07-05 00:59:25 +02:00
|
|
|
|
2001-07-07 05:01:37 +02:00
|
|
|
/* Look at the direction input of the device, and select the
|
|
|
|
|
shift direction accordingly. */
|
2004-06-30 04:16:26 +02:00
|
|
|
if (net->right_flag())
|
|
|
|
|
obj->type = IVL_LPM_SHIFTR;
|
|
|
|
|
if (net->signed_flag())
|
|
|
|
|
obj->u_.shift.signed_flag = 1;
|
|
|
|
|
else
|
|
|
|
|
obj->u_.shift.signed_flag = 0;
|
2001-07-05 00:59:25 +02:00
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = net->width();
|
2001-07-05 00:59:25 +02:00
|
|
|
obj->u_.shift.select = net->width_dist();
|
|
|
|
|
|
2005-02-19 03:43:38 +01:00
|
|
|
const Nexus*nex;
|
2001-07-05 00:59:25 +02:00
|
|
|
|
2005-02-19 03:43:38 +01:00
|
|
|
nex = net->pin_Result().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2001-07-05 00:59:25 +02:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.shift.q = nex->t_cookie();
|
2005-02-19 03:43:38 +01:00
|
|
|
nexus_lpm_add(obj->u_.shift.q, obj, 0, IVL_DR_STRONG, IVL_DR_STRONG);
|
2001-07-05 00:59:25 +02:00
|
|
|
|
2005-02-19 03:43:38 +01:00
|
|
|
nex = net->pin_Data().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2001-07-05 00:59:25 +02:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.shift.d = nex->t_cookie();
|
2005-02-19 03:43:38 +01:00
|
|
|
nexus_lpm_add(obj->u_.shift.d, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2001-07-05 00:59:25 +02:00
|
|
|
|
2005-02-19 03:43:38 +01:00
|
|
|
nex = net->pin_Distance().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2001-07-05 00:59:25 +02:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.shift.s = nex->t_cookie();
|
2005-02-19 03:43:38 +01:00
|
|
|
nexus_lpm_add(obj->u_.shift.s, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2001-07-05 00:59:25 +02:00
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
2001-07-05 00:59:25 +02:00
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-16 19:53:20 +02:00
|
|
|
bool dll_target::lpm_arith1_(ivl_lpm_type_t lpm_type, unsigned width, bool signed_flag, const NetNode*net)
|
2008-06-21 03:11:11 +02:00
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
2010-10-16 19:53:20 +02:00
|
|
|
obj->type = lpm_type;
|
|
|
|
|
obj->name = net->name(); // NetCastInt2 names are permallocated
|
2008-06-21 03:11:11 +02:00
|
|
|
assert(net->scope());
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2008-06-21 03:11:11 +02:00
|
|
|
|
2010-10-16 19:53:20 +02:00
|
|
|
obj->width = width;
|
|
|
|
|
obj->u_.arith.signed_flag = signed_flag? 1 : 0;
|
2008-06-21 03:11:11 +02:00
|
|
|
|
|
|
|
|
const Nexus*nex;
|
|
|
|
|
|
|
|
|
|
nex = net->pin(0).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
|
|
|
|
obj->u_.arith.q = nex->t_cookie();
|
|
|
|
|
|
|
|
|
|
nex = net->pin(1).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
obj->u_.arith.a = nex->t_cookie();
|
|
|
|
|
|
|
|
|
|
nexus_lpm_add(obj->u_.arith.q, obj, 0, IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
nexus_lpm_add(obj->u_.arith.a, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
|
|
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
|
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-16 19:53:20 +02:00
|
|
|
bool dll_target::lpm_cast_int2(const NetCastInt2*net)
|
2008-06-18 02:07:19 +02:00
|
|
|
{
|
2010-10-16 19:53:20 +02:00
|
|
|
return lpm_arith1_(IVL_LPM_CAST_INT2, net->width(), true, net);
|
|
|
|
|
}
|
2008-06-18 02:07:19 +02:00
|
|
|
|
2010-10-16 19:53:20 +02:00
|
|
|
bool dll_target::lpm_cast_int4(const NetCastInt4*net)
|
|
|
|
|
{
|
|
|
|
|
return lpm_arith1_(IVL_LPM_CAST_INT, net->width(), true, net);
|
|
|
|
|
}
|
2008-06-18 02:07:19 +02:00
|
|
|
|
2010-10-16 19:53:20 +02:00
|
|
|
bool dll_target::lpm_cast_real(const NetCastReal*net)
|
|
|
|
|
{
|
|
|
|
|
return lpm_arith1_(IVL_LPM_CAST_REAL, 0, net->signed_flag(), net);
|
2008-06-18 02:07:19 +02:00
|
|
|
}
|
|
|
|
|
|
2001-06-15 07:01:09 +02:00
|
|
|
/*
|
|
|
|
|
* Make out of the NetCompare object an ivl_lpm_s object. The
|
|
|
|
|
* comparators in ivl_target do not support < or <=, but they can be
|
|
|
|
|
* trivially converted to > and >= by swapping the operands.
|
|
|
|
|
*/
|
2001-06-15 06:14:18 +02:00
|
|
|
void dll_target::lpm_compare(const NetCompare*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
2003-03-06 01:28:41 +01:00
|
|
|
obj->name = net->name(); // NetCompare names are permallocated
|
2001-06-15 06:14:18 +02:00
|
|
|
assert(net->scope());
|
2001-10-19 23:53:24 +02:00
|
|
|
obj->scope = find_scope(des_, net->scope());
|
2001-06-15 06:14:18 +02:00
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2001-06-15 06:14:18 +02:00
|
|
|
|
2001-06-15 07:01:09 +02:00
|
|
|
bool swap_operands = false;
|
|
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = net->width();
|
2003-04-11 07:18:08 +02:00
|
|
|
obj->u_.arith.signed_flag = net->get_signed()? 1 : 0;
|
2005-01-16 05:20:32 +01:00
|
|
|
|
|
|
|
|
const Nexus*nex;
|
|
|
|
|
|
|
|
|
|
nex = net->pin_DataA().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.a = nex->t_cookie();
|
2005-01-16 05:20:32 +01:00
|
|
|
|
|
|
|
|
nex = net->pin_DataB().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.b = nex->t_cookie();
|
2005-01-16 05:20:32 +01:00
|
|
|
|
2001-06-15 06:14:18 +02:00
|
|
|
|
|
|
|
|
if (net->pin_AGEB().is_linked()) {
|
2005-01-16 05:20:32 +01:00
|
|
|
nex = net->pin_AGEB().nexus();
|
2001-06-15 06:14:18 +02:00
|
|
|
obj->type = IVL_LPM_CMP_GE;
|
|
|
|
|
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.q = nex->t_cookie();
|
2005-01-16 05:20:32 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.q, obj, 0,
|
2001-06-15 06:14:18 +02:00
|
|
|
IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
|
|
|
|
|
} else if (net->pin_AGB().is_linked()) {
|
2005-01-16 05:20:32 +01:00
|
|
|
nex = net->pin_AGB().nexus();
|
2001-06-15 06:14:18 +02:00
|
|
|
obj->type = IVL_LPM_CMP_GT;
|
|
|
|
|
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.q = nex->t_cookie();
|
2005-01-16 05:20:32 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.q, obj, 0,
|
2001-06-15 06:14:18 +02:00
|
|
|
IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
|
2001-06-15 07:01:09 +02:00
|
|
|
} else if (net->pin_ALEB().is_linked()) {
|
2005-01-16 05:20:32 +01:00
|
|
|
nex = net->pin_ALEB().nexus();
|
2001-06-15 07:01:09 +02:00
|
|
|
obj->type = IVL_LPM_CMP_GE;
|
|
|
|
|
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.q = nex->t_cookie();
|
2005-01-16 05:20:32 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.q, obj, 0,
|
2001-06-15 07:01:09 +02:00
|
|
|
IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
|
|
|
|
|
swap_operands = true;
|
|
|
|
|
|
|
|
|
|
} else if (net->pin_ALB().is_linked()) {
|
2005-01-16 05:20:32 +01:00
|
|
|
nex = net->pin_ALB().nexus();
|
2001-06-15 07:01:09 +02:00
|
|
|
obj->type = IVL_LPM_CMP_GT;
|
|
|
|
|
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.q = nex->t_cookie();
|
2005-01-16 05:20:32 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.q, obj, 0,
|
2001-06-15 07:01:09 +02:00
|
|
|
IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
|
|
|
|
|
swap_operands = true;
|
|
|
|
|
|
2001-09-01 03:57:31 +02:00
|
|
|
} else if (net->pin_AEB().is_linked()) {
|
2005-01-16 05:20:32 +01:00
|
|
|
nex = net->pin_AEB().nexus();
|
2001-09-01 03:57:31 +02:00
|
|
|
obj->type = IVL_LPM_CMP_EQ;
|
|
|
|
|
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.q = nex->t_cookie();
|
2005-01-16 05:20:32 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.q, obj, 0,
|
2001-09-01 03:57:31 +02:00
|
|
|
IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
|
|
|
|
|
} else if (net->pin_ANEB().is_linked()) {
|
2005-01-16 05:20:32 +01:00
|
|
|
nex = net->pin_ANEB().nexus();
|
2001-09-01 03:57:31 +02:00
|
|
|
obj->type = IVL_LPM_CMP_NE;
|
|
|
|
|
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.q = nex->t_cookie();
|
2005-01-16 05:20:32 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.q, obj, 0,
|
2001-09-01 03:57:31 +02:00
|
|
|
IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
|
2001-06-15 06:14:18 +02:00
|
|
|
} else {
|
|
|
|
|
assert(0);
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-16 05:20:32 +01:00
|
|
|
if (swap_operands) {
|
|
|
|
|
ivl_nexus_t tmp = obj->u_.arith.a;
|
|
|
|
|
obj->u_.arith.a = obj->u_.arith.b;
|
|
|
|
|
obj->u_.arith.b = tmp;
|
2001-06-15 06:14:18 +02:00
|
|
|
}
|
2005-01-16 05:20:32 +01:00
|
|
|
|
|
|
|
|
nexus_lpm_add(obj->u_.arith.a, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
nexus_lpm_add(obj->u_.arith.b, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2001-06-15 06:14:18 +02:00
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
2001-06-15 06:14:18 +02:00
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-16 04:19:26 +02:00
|
|
|
void dll_target::lpm_divide(const NetDivide*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_DIVIDE;
|
2003-03-06 01:28:41 +01:00
|
|
|
obj->name = net->name();
|
2001-10-16 04:19:26 +02:00
|
|
|
assert(net->scope());
|
2001-10-19 23:53:24 +02:00
|
|
|
obj->scope = find_scope(des_, net->scope());
|
2001-10-16 04:19:26 +02:00
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2001-10-16 04:19:26 +02:00
|
|
|
|
|
|
|
|
unsigned wid = net->width_r();
|
|
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = wid;
|
2004-06-30 04:16:26 +02:00
|
|
|
obj->u_.arith.signed_flag = net->get_signed()? 1 : 0;
|
2001-10-16 04:19:26 +02:00
|
|
|
|
2005-02-19 03:43:38 +01:00
|
|
|
const Nexus*nex;
|
2001-10-16 04:19:26 +02:00
|
|
|
|
2005-02-19 03:43:38 +01:00
|
|
|
nex = net->pin_Result().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2001-10-16 04:19:26 +02:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.q = nex->t_cookie();
|
2005-02-19 03:43:38 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.q, obj, 0, IVL_DR_STRONG, IVL_DR_STRONG);
|
2004-06-30 04:16:26 +02:00
|
|
|
|
2005-02-19 03:43:38 +01:00
|
|
|
nex = net->pin_DataA().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2004-06-30 04:16:26 +02:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.a = nex->t_cookie();
|
2005-02-19 03:43:38 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.a, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2001-10-16 04:19:26 +02:00
|
|
|
|
2005-02-19 03:43:38 +01:00
|
|
|
nex = net->pin_DataB().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2001-10-16 04:19:26 +02:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.b = nex->t_cookie();
|
2005-02-19 03:43:38 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.b, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2001-10-16 04:19:26 +02:00
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
2001-10-16 04:19:26 +02:00
|
|
|
|
|
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-03 05:19:01 +01:00
|
|
|
void dll_target::lpm_modulo(const NetModulo*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_MOD;
|
2003-03-06 01:28:41 +01:00
|
|
|
obj->name = net->name();
|
2002-01-03 05:19:01 +01:00
|
|
|
assert(net->scope());
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2002-01-03 05:19:01 +01:00
|
|
|
|
|
|
|
|
unsigned wid = net->width_r();
|
|
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = wid;
|
2008-11-08 03:23:04 +01:00
|
|
|
obj->u_.arith.signed_flag = net->get_signed()? 1 : 0;
|
2002-01-03 05:19:01 +01:00
|
|
|
|
2005-03-12 07:43:35 +01:00
|
|
|
const Nexus*nex;
|
2002-01-03 05:19:01 +01:00
|
|
|
|
2005-03-12 07:43:35 +01:00
|
|
|
nex = net->pin_Result().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2002-01-03 05:19:01 +01:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.q = nex->t_cookie();
|
2005-03-12 07:43:35 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.q, obj, 0, IVL_DR_STRONG, IVL_DR_STRONG);
|
2002-01-03 05:19:01 +01:00
|
|
|
|
2005-03-12 07:43:35 +01:00
|
|
|
nex = net->pin_DataA().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2002-01-03 05:19:01 +01:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.a = nex->t_cookie();
|
2005-03-12 07:43:35 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.a, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2002-01-03 05:19:01 +01:00
|
|
|
|
2005-03-12 07:43:35 +01:00
|
|
|
nex = net->pin_DataB().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2002-01-03 05:19:01 +01:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.b = nex->t_cookie();
|
2005-03-12 07:43:35 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.b, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2002-01-03 05:19:01 +01:00
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
2002-01-03 05:19:01 +01:00
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
}
|
|
|
|
|
|
2000-11-11 01:03:36 +01:00
|
|
|
void dll_target::lpm_ff(const NetFF*net)
|
|
|
|
|
{
|
2001-04-26 07:12:02 +02:00
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_FF;
|
2003-03-06 01:28:41 +01:00
|
|
|
obj->name = net->name();
|
2001-10-19 23:53:24 +02:00
|
|
|
obj->scope = find_scope(des_, net->scope());
|
2001-04-26 07:12:02 +02:00
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2000-11-11 01:03:36 +01:00
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = net->width();
|
2001-04-26 07:12:02 +02:00
|
|
|
|
|
|
|
|
scope_add_lpm(obj->scope, obj);
|
2000-11-11 01:03:36 +01:00
|
|
|
|
|
|
|
|
const Nexus*nex;
|
|
|
|
|
|
2015-06-13 16:56:12 +02:00
|
|
|
/* Set the clock polarity. */
|
|
|
|
|
obj->u_.ff.negedge_flag = net->is_negedge();
|
|
|
|
|
|
2000-12-05 07:29:33 +01:00
|
|
|
/* Set the clk signal to point to the nexus, and the nexus to
|
|
|
|
|
point back to this device. */
|
2000-11-11 01:03:36 +01:00
|
|
|
nex = net->pin_Clock().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.ff.clk = nex->t_cookie();
|
2001-04-26 07:12:02 +02:00
|
|
|
assert(obj->u_.ff.clk);
|
2001-05-12 05:18:44 +02:00
|
|
|
nexus_lpm_add(obj->u_.ff.clk, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2000-11-11 01:03:36 +01:00
|
|
|
|
2001-09-01 00:58:39 +02:00
|
|
|
/* If there is a clock enable, then connect it up to the FF
|
|
|
|
|
device. */
|
|
|
|
|
if (net->pin_Enable().is_linked()) {
|
|
|
|
|
nex = net->pin_Enable().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.ff.we = nex->t_cookie();
|
2001-09-01 00:58:39 +02:00
|
|
|
assert(obj->u_.ff.we);
|
|
|
|
|
nexus_lpm_add(obj->u_.ff.we, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
} else {
|
|
|
|
|
obj->u_.ff.we = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-26 05:18:04 +02:00
|
|
|
if (net->pin_Aclr().is_linked()) {
|
|
|
|
|
nex = net->pin_Aclr().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.ff.aclr = nex->t_cookie();
|
2002-09-26 05:18:04 +02:00
|
|
|
assert(obj->u_.ff.aclr);
|
|
|
|
|
nexus_lpm_add(obj->u_.ff.aclr, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
} else {
|
|
|
|
|
obj->u_.ff.aclr = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (net->pin_Aset().is_linked()) {
|
|
|
|
|
nex = net->pin_Aset().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.ff.aset = nex->t_cookie();
|
2002-09-26 05:18:04 +02:00
|
|
|
assert(obj->u_.ff.aset);
|
2002-10-23 03:45:24 +02:00
|
|
|
nexus_lpm_add(obj->u_.ff.aset, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
|
|
|
|
|
verinum tmp = net->aset_value();
|
2015-06-13 16:56:12 +02:00
|
|
|
if (tmp.len() > 0)
|
|
|
|
|
obj->u_.ff.aset_value = expr_from_value_(tmp);
|
|
|
|
|
else
|
|
|
|
|
obj->u_.ff.aset_value = 0;
|
2002-10-23 03:45:24 +02:00
|
|
|
|
2002-09-26 05:18:04 +02:00
|
|
|
} else {
|
|
|
|
|
obj->u_.ff.aset = 0;
|
2002-10-23 03:45:24 +02:00
|
|
|
obj->u_.ff.aset_value = 0;
|
2002-09-26 05:18:04 +02:00
|
|
|
}
|
|
|
|
|
|
2003-08-15 04:23:52 +02:00
|
|
|
if (net->pin_Sclr().is_linked()) {
|
|
|
|
|
nex = net->pin_Sclr().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.ff.sclr = nex->t_cookie();
|
2003-08-15 04:23:52 +02:00
|
|
|
assert(obj->u_.ff.sclr);
|
|
|
|
|
nexus_lpm_add(obj->u_.ff.sclr, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
} else {
|
|
|
|
|
obj->u_.ff.sclr = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-04 01:33:29 +02:00
|
|
|
if (net->pin_Sset().is_linked()) {
|
|
|
|
|
nex = net->pin_Sset().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.ff.sset = nex->t_cookie();
|
2003-09-04 01:33:29 +02:00
|
|
|
assert(obj->u_.ff.sset);
|
|
|
|
|
nexus_lpm_add(obj->u_.ff.sset, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
|
|
|
|
|
verinum tmp = net->sset_value();
|
2015-06-13 16:56:12 +02:00
|
|
|
if (tmp.len() > 0)
|
|
|
|
|
obj->u_.ff.sset_value = expr_from_value_(tmp);
|
|
|
|
|
else
|
|
|
|
|
obj->u_.ff.sset_value = 0;
|
2003-09-04 01:33:29 +02:00
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
obj->u_.ff.sset = 0;
|
|
|
|
|
obj->u_.ff.sset_value = 0;
|
|
|
|
|
}
|
2003-08-22 06:14:33 +02:00
|
|
|
|
2005-04-25 01:44:01 +02:00
|
|
|
nex = net->pin_Q().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.ff.q.pin = nex->t_cookie();
|
2005-04-25 01:44:01 +02:00
|
|
|
nexus_lpm_add(obj->u_.ff.q.pin, obj, 0,
|
|
|
|
|
IVL_DR_STRONG, IVL_DR_STRONG);
|
2000-11-11 01:03:36 +01:00
|
|
|
|
2005-04-25 01:44:01 +02:00
|
|
|
nex = net->pin_Data().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.ff.d.pin = nex->t_cookie();
|
2005-04-25 01:44:01 +02:00
|
|
|
nexus_lpm_add(obj->u_.ff.d.pin, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2001-04-26 07:12:02 +02:00
|
|
|
}
|
|
|
|
|
|
2016-03-10 22:13:27 +01:00
|
|
|
void dll_target::lpm_latch(const NetLatch*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_LATCH;
|
|
|
|
|
obj->name = net->name();
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
|
|
|
|
FILE_NAME(obj, net);
|
|
|
|
|
|
|
|
|
|
obj->width = net->width();
|
|
|
|
|
|
|
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
|
|
|
|
|
const Nexus*nex;
|
|
|
|
|
|
2016-03-12 01:10:47 +01:00
|
|
|
nex = net->pin_Enable().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
obj->u_.latch.e = nex->t_cookie();
|
|
|
|
|
assert(obj->u_.latch.e);
|
|
|
|
|
nexus_lpm_add(obj->u_.latch.e, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2016-03-10 22:13:27 +01:00
|
|
|
|
|
|
|
|
nex = net->pin_Q().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
obj->u_.latch.q.pin = nex->t_cookie();
|
|
|
|
|
nexus_lpm_add(obj->u_.latch.q.pin, obj, 0,
|
|
|
|
|
IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
|
|
|
|
|
nex = net->pin_Data().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
obj->u_.latch.d.pin = nex->t_cookie();
|
|
|
|
|
nexus_lpm_add(obj->u_.latch.d.pin, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-28 06:39:33 +01:00
|
|
|
/*
|
|
|
|
|
* Make the NetMult object into an IVL_LPM_MULT node.
|
|
|
|
|
*/
|
2001-06-17 01:45:05 +02:00
|
|
|
void dll_target::lpm_mult(const NetMult*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_MULT;
|
2003-03-06 01:28:41 +01:00
|
|
|
obj->name = net->name();
|
2001-06-17 01:45:05 +02:00
|
|
|
assert(net->scope());
|
2001-10-19 23:53:24 +02:00
|
|
|
obj->scope = find_scope(des_, net->scope());
|
2001-06-17 01:45:05 +02:00
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2001-06-17 01:45:05 +02:00
|
|
|
|
|
|
|
|
unsigned wid = net->width_r();
|
|
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = wid;
|
2008-09-01 23:30:09 +02:00
|
|
|
obj->u_.arith.signed_flag = 0;
|
2001-06-17 01:45:05 +02:00
|
|
|
|
2005-01-28 06:39:33 +01:00
|
|
|
const Nexus*nex;
|
2003-03-29 06:51:25 +01:00
|
|
|
|
2005-01-28 06:39:33 +01:00
|
|
|
nex = net->pin_Result().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2003-03-29 06:51:25 +01:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.q = nex->t_cookie();
|
2005-01-28 06:39:33 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.q, obj, 0, IVL_DR_STRONG, IVL_DR_STRONG);
|
2001-06-17 01:45:05 +02:00
|
|
|
|
2005-01-28 06:39:33 +01:00
|
|
|
nex = net->pin_DataA().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2001-06-17 01:45:05 +02:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.a = nex->t_cookie();
|
2005-01-28 06:39:33 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.a, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2001-06-17 01:45:05 +02:00
|
|
|
|
2005-01-28 06:39:33 +01:00
|
|
|
nex = net->pin_DataB().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2001-06-17 01:45:05 +02:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.arith.b = nex->t_cookie();
|
2005-01-28 06:39:33 +01:00
|
|
|
nexus_lpm_add(obj->u_.arith.b, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2003-03-29 06:51:25 +01:00
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
2003-03-29 06:51:25 +01:00
|
|
|
|
2001-06-17 01:45:05 +02:00
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
}
|
|
|
|
|
|
2001-12-18 06:34:02 +01:00
|
|
|
/*
|
|
|
|
|
* Hook up the mux devices so that the select expression selects the
|
|
|
|
|
* correct sub-expression with the ivl_lpm_data2 function.
|
|
|
|
|
*/
|
2001-04-26 07:12:02 +02:00
|
|
|
void dll_target::lpm_mux(const NetMux*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_MUX;
|
2008-06-24 17:46:16 +02:00
|
|
|
obj->name = net->name(); // The NetMux permallocates its name.
|
2001-10-19 23:53:24 +02:00
|
|
|
obj->scope = find_scope(des_, net->scope());
|
2001-04-26 07:12:02 +02:00
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2001-04-26 07:12:02 +02:00
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = net->width();
|
2001-04-26 07:12:02 +02:00
|
|
|
obj->u_.mux.size = net->size();
|
|
|
|
|
obj->u_.mux.swid = net->sel_width();
|
|
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
2001-04-26 07:12:02 +02:00
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
|
|
|
|
|
const Nexus*nex;
|
|
|
|
|
|
|
|
|
|
/* Connect the output bits. */
|
2005-02-12 07:25:40 +01:00
|
|
|
nex = net->pin_Result().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.mux.q = nex->t_cookie();
|
2005-02-12 07:25:40 +01:00
|
|
|
nexus_lpm_add(obj->u_.mux.q, obj, 0,
|
2010-03-16 23:16:53 +01:00
|
|
|
net->pin_Result().drive0(),
|
|
|
|
|
net->pin_Result().drive1());
|
2001-04-26 07:12:02 +02:00
|
|
|
|
|
|
|
|
/* Connect the select bits. */
|
2005-02-12 07:25:40 +01:00
|
|
|
nex = net->pin_Sel().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.mux.s = nex->t_cookie();
|
2005-02-12 07:25:40 +01:00
|
|
|
nexus_lpm_add(obj->u_.mux.s, obj, 0,
|
|
|
|
|
IVL_DR_HiZ, IVL_DR_HiZ);
|
2001-04-26 07:12:02 +02:00
|
|
|
|
|
|
|
|
unsigned selects = obj->u_.mux.size;
|
|
|
|
|
|
2005-02-12 07:25:40 +01:00
|
|
|
obj->u_.mux.d = new ivl_nexus_t [selects];
|
2001-04-26 07:12:02 +02:00
|
|
|
|
2005-02-12 07:25:40 +01:00
|
|
|
for (unsigned sdx = 0 ; sdx < selects ; sdx += 1) {
|
|
|
|
|
nex = net->pin_Data(sdx).nexus();
|
2007-03-26 20:17:50 +02:00
|
|
|
ivl_nexus_t tmp = nex->t_cookie();
|
2005-02-12 07:25:40 +01:00
|
|
|
obj->u_.mux.d[sdx] = tmp;
|
2014-07-20 02:22:33 +02:00
|
|
|
if (tmp == 0) {
|
|
|
|
|
cerr << net->get_fileline() << ": internal error: "
|
|
|
|
|
<< "dll_target::lpm_mux: "
|
|
|
|
|
<< "Missing data port " << sdx
|
|
|
|
|
<< " of mux " << obj->name << "." << endl;
|
|
|
|
|
}
|
|
|
|
|
ivl_assert(*net, tmp);
|
2005-02-12 07:25:40 +01:00
|
|
|
nexus_lpm_add(tmp, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
}
|
2001-04-26 07:12:02 +02:00
|
|
|
|
2000-11-11 01:03:36 +01:00
|
|
|
}
|
|
|
|
|
|
2008-01-31 02:53:06 +01:00
|
|
|
/*
|
|
|
|
|
* Make the NetPow object into an IVL_LPM_POW node.
|
|
|
|
|
*/
|
|
|
|
|
void dll_target::lpm_pow(const NetPow*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_POW;
|
2008-02-09 02:32:57 +01:00
|
|
|
FILE_NAME(obj, net);
|
2008-01-31 02:53:06 +01:00
|
|
|
obj->name = net->name();
|
|
|
|
|
assert(net->scope());
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2008-01-31 02:53:06 +01:00
|
|
|
|
|
|
|
|
unsigned wid = net->width_r();
|
2008-02-05 04:43:50 +01:00
|
|
|
obj->u_.arith.signed_flag = net->get_signed()? 1 : 0;
|
2008-01-31 02:53:06 +01:00
|
|
|
|
|
|
|
|
obj->width = wid;
|
|
|
|
|
|
|
|
|
|
const Nexus*nex;
|
|
|
|
|
|
|
|
|
|
nex = net->pin_Result().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
|
|
|
|
obj->u_.arith.q = nex->t_cookie();
|
|
|
|
|
nexus_lpm_add(obj->u_.arith.q, obj, 0, IVL_DR_STRONG, IVL_DR_STRONG);
|
|
|
|
|
|
|
|
|
|
nex = net->pin_DataA().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
|
|
|
|
obj->u_.arith.a = nex->t_cookie();
|
|
|
|
|
nexus_lpm_add(obj->u_.arith.a, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
|
|
|
|
|
nex = net->pin_DataB().nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
|
|
|
|
obj->u_.arith.b = nex->t_cookie();
|
|
|
|
|
nexus_lpm_add(obj->u_.arith.b, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
|
|
|
|
|
|
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
|
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-30 00:55:43 +01:00
|
|
|
bool dll_target::concat(const NetConcat*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
2013-02-02 19:44:16 +01:00
|
|
|
obj->type = net->transparent()? IVL_LPM_CONCATZ : IVL_LPM_CONCAT;
|
2004-12-30 00:55:43 +01:00
|
|
|
obj->name = net->name(); // NetConcat names are permallocated
|
|
|
|
|
assert(net->scope());
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2004-12-30 00:55:43 +01:00
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = net->width();
|
2004-12-30 00:55:43 +01:00
|
|
|
|
|
|
|
|
obj->u_.concat.inputs = net->pin_count() - 1;
|
|
|
|
|
obj->u_.concat.pins = new ivl_nexus_t[obj->u_.concat.inputs+1];
|
|
|
|
|
|
|
|
|
|
for (unsigned idx = 0 ; idx < obj->u_.concat.inputs+1 ; idx += 1) {
|
|
|
|
|
ivl_drive_t dr = idx == 0? IVL_DR_STRONG : IVL_DR_HiZ;
|
|
|
|
|
const Nexus*nex = net->pin(idx).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.concat.pins[idx] = nex->t_cookie();
|
2004-12-30 00:55:43 +01:00
|
|
|
nexus_lpm_add(obj->u_.concat.pins[idx], obj, 0, dr, dr);
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
2004-12-30 00:55:43 +01:00
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-11 03:31:25 +01:00
|
|
|
bool dll_target::part_select(const NetPartSelect*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
2005-01-09 21:16:00 +01:00
|
|
|
switch (net->dir()) {
|
|
|
|
|
case NetPartSelect::VP:
|
|
|
|
|
obj->type = IVL_LPM_PART_VP;
|
|
|
|
|
break;
|
|
|
|
|
case NetPartSelect::PV:
|
|
|
|
|
obj->type = IVL_LPM_PART_PV;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2004-12-11 03:31:25 +01:00
|
|
|
obj->name = net->name(); // NetPartSelect names are permallocated.
|
|
|
|
|
assert(net->scope());
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2004-12-11 03:31:25 +01:00
|
|
|
|
2009-09-19 00:43:09 +02:00
|
|
|
/* Part selects are always unsigned, so we use this to indicate
|
|
|
|
|
* if the part select base signal is signed or not. */
|
|
|
|
|
if (net->signed_flag())
|
|
|
|
|
obj->u_.part.signed_flag = 1;
|
|
|
|
|
else
|
|
|
|
|
obj->u_.part.signed_flag = 0;
|
2004-12-11 03:31:25 +01:00
|
|
|
|
|
|
|
|
/* Choose the width of the part select. */
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = net->width();
|
2004-12-11 03:31:25 +01:00
|
|
|
obj->u_.part.base = net->base();
|
2005-05-09 01:40:14 +02:00
|
|
|
obj->u_.part.s = 0;
|
2005-08-06 19:58:16 +02:00
|
|
|
|
2004-12-11 03:31:25 +01:00
|
|
|
const Nexus*nex;
|
|
|
|
|
|
2005-01-09 21:16:00 +01:00
|
|
|
switch (obj->type) {
|
|
|
|
|
case IVL_LPM_PART_VP:
|
|
|
|
|
/* NetPartSelect:pin(0) is the output pin. */
|
|
|
|
|
nex = net->pin(0).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2004-12-11 03:31:25 +01:00
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.part.q = nex->t_cookie();
|
2004-12-11 03:31:25 +01:00
|
|
|
|
2005-01-09 21:16:00 +01:00
|
|
|
/* NetPartSelect:pin(1) is the input pin. */
|
|
|
|
|
nex = net->pin(1).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.part.a = nex->t_cookie();
|
2005-05-09 01:40:14 +02:00
|
|
|
|
|
|
|
|
/* If the part select has an additional pin, that pin is
|
|
|
|
|
a variable select base. */
|
|
|
|
|
if (net->pin_count() >= 3) {
|
|
|
|
|
nex = net->pin(2).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.part.s = nex->t_cookie();
|
2005-05-09 01:40:14 +02:00
|
|
|
}
|
2005-01-09 21:16:00 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IVL_LPM_PART_PV:
|
|
|
|
|
/* NetPartSelect:pin(1) is the output pin. */
|
|
|
|
|
nex = net->pin(1).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.part.q = nex->t_cookie();
|
2005-01-09 21:16:00 +01:00
|
|
|
|
|
|
|
|
/* NetPartSelect:pin(0) is the input pin. */
|
|
|
|
|
nex = net->pin(0).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.part.a = nex->t_cookie();
|
2005-01-09 21:16:00 +01:00
|
|
|
break;
|
2004-12-11 03:31:25 +01:00
|
|
|
|
2005-01-09 21:16:00 +01:00
|
|
|
default:
|
|
|
|
|
assert(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nexus_lpm_add(obj->u_.part.q, obj, 0, IVL_DR_STRONG, IVL_DR_STRONG);
|
2008-06-03 20:16:25 +02:00
|
|
|
nexus_lpm_add(obj->u_.part.a, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2005-08-06 19:58:16 +02:00
|
|
|
|
|
|
|
|
/* The select input is optional. */
|
|
|
|
|
if (obj->u_.part.s)
|
2008-02-16 00:05:39 +01:00
|
|
|
nexus_lpm_add(obj->u_.part.s, obj, 0, IVL_DR_HiZ, IVL_DR_HiZ);
|
2004-12-11 03:31:25 +01:00
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
2004-12-11 03:31:25 +01:00
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-08 01:12:36 +01:00
|
|
|
bool dll_target::replicate(const NetReplicate*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_lpm_t obj = new struct ivl_lpm_s;
|
|
|
|
|
obj->type = IVL_LPM_REPEAT;
|
|
|
|
|
obj->name = net->name();
|
|
|
|
|
assert(net->scope());
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
assert(obj->scope);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2005-02-08 01:12:36 +01:00
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
obj->width = net->width();
|
2005-02-08 01:12:36 +01:00
|
|
|
obj->u_.repeat.count = net->repeat();
|
|
|
|
|
|
|
|
|
|
ivl_drive_t dr = IVL_DR_STRONG;
|
|
|
|
|
const Nexus*nex = net->pin(0).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.repeat.q = nex->t_cookie();
|
2005-02-08 01:12:36 +01:00
|
|
|
nexus_lpm_add(obj->u_.repeat.q, obj, 0, dr, dr);
|
|
|
|
|
|
|
|
|
|
dr = IVL_DR_HiZ;
|
|
|
|
|
nex = net->pin(1).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
|
|
|
|
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->u_.repeat.a = nex->t_cookie();
|
2005-02-08 01:12:36 +01:00
|
|
|
nexus_lpm_add(obj->u_.repeat.a, obj, 0, dr, dr);
|
|
|
|
|
|
2008-01-21 20:13:28 +01:00
|
|
|
make_lpm_delays_(obj, net);
|
|
|
|
|
|
2005-02-08 01:12:36 +01:00
|
|
|
scope_add_lpm(obj->scope, obj);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-21 18:49:45 +02:00
|
|
|
/*
|
|
|
|
|
* The assignment l-values are captured by the assignment statements
|
|
|
|
|
* themselves in the process handling.
|
|
|
|
|
*/
|
2010-07-24 00:58:00 +02:00
|
|
|
void dll_target::net_assign(const NetAssign_*) const
|
2000-10-21 18:49:45 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-14 06:39:56 +02:00
|
|
|
bool dll_target::net_const(const NetConst*net)
|
|
|
|
|
{
|
2000-10-05 07:03:01 +02:00
|
|
|
unsigned idx;
|
2000-10-07 01:46:50 +02:00
|
|
|
char*bits;
|
2009-12-10 22:24:27 +01:00
|
|
|
static char*bits_tmp = 0;
|
2010-01-27 17:56:38 +01:00
|
|
|
static unsigned bits_cnt = 0;
|
2000-10-07 01:46:50 +02:00
|
|
|
|
|
|
|
|
struct ivl_net_const_s *obj = new struct ivl_net_const_s;
|
2000-10-05 07:03:01 +02:00
|
|
|
|
2011-04-18 20:07:41 +02:00
|
|
|
if (net->is_string()) {
|
|
|
|
|
obj->type = IVL_VT_STRING;
|
|
|
|
|
assert((net->width() % 8) == 0);
|
|
|
|
|
} else obj->type = IVL_VT_BOOL;
|
2011-02-07 04:47:11 +01:00
|
|
|
assert(net->scope());
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
FILE_NAME(obj, net);
|
2005-07-07 18:22:49 +02:00
|
|
|
|
2004-12-11 03:31:25 +01:00
|
|
|
/* constants have a single vector output. */
|
|
|
|
|
assert(net->pin_count() == 1);
|
|
|
|
|
|
|
|
|
|
obj->width_ = net->width();
|
2013-02-15 20:49:10 +01:00
|
|
|
obj->signed_ = net->value().has_sign();
|
2005-07-07 18:22:49 +02:00
|
|
|
if (obj->width_ <= sizeof(obj->b.bit_)) {
|
2000-10-07 01:46:50 +02:00
|
|
|
bits = obj->b.bit_;
|
|
|
|
|
|
|
|
|
|
} else {
|
2010-01-27 17:56:38 +01:00
|
|
|
if (obj->width_ >= bits_cnt) {
|
2009-12-10 22:24:27 +01:00
|
|
|
bits_tmp = (char*)realloc(bits_tmp, obj->width_+1);
|
|
|
|
|
bits_cnt = obj->width_+1;
|
|
|
|
|
}
|
|
|
|
|
bits = bits_tmp;
|
2000-10-07 01:46:50 +02:00
|
|
|
}
|
|
|
|
|
|
2000-10-05 07:03:01 +02:00
|
|
|
for (idx = 0 ; idx < obj->width_ ; idx += 1)
|
|
|
|
|
switch (net->value(idx)) {
|
|
|
|
|
case verinum::V0:
|
2000-10-07 01:46:50 +02:00
|
|
|
bits[idx] = '0';
|
2000-10-05 07:03:01 +02:00
|
|
|
break;
|
|
|
|
|
case verinum::V1:
|
2000-10-07 01:46:50 +02:00
|
|
|
bits[idx] = '1';
|
2000-10-05 07:03:01 +02:00
|
|
|
break;
|
|
|
|
|
case verinum::Vx:
|
2008-09-14 01:43:39 +02:00
|
|
|
if (obj->type == IVL_VT_BOOL)
|
|
|
|
|
obj->type = IVL_VT_LOGIC;
|
2000-10-07 01:46:50 +02:00
|
|
|
bits[idx] = 'x';
|
2011-04-18 20:07:41 +02:00
|
|
|
assert(! net->is_string());
|
2000-10-05 07:03:01 +02:00
|
|
|
break;
|
|
|
|
|
case verinum::Vz:
|
2008-09-14 01:43:39 +02:00
|
|
|
if (obj->type == IVL_VT_BOOL)
|
|
|
|
|
obj->type = IVL_VT_LOGIC;
|
2000-10-07 01:46:50 +02:00
|
|
|
bits[idx] = 'z';
|
2011-04-18 20:07:41 +02:00
|
|
|
assert(! net->is_string());
|
2000-10-05 07:03:01 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2000-08-14 06:39:56 +02:00
|
|
|
|
2009-12-10 22:24:27 +01:00
|
|
|
if (obj->width_ > sizeof(obj->b.bit_)) {
|
|
|
|
|
bits[obj->width_] = 0;
|
|
|
|
|
obj->b.bits_ = net_const_strings.make(bits);
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
/* Connect to all the nexus objects. Note that the one-bit
|
|
|
|
|
case can be handled more efficiently without allocating
|
|
|
|
|
array space. */
|
2002-01-06 04:15:43 +01:00
|
|
|
|
2004-12-11 03:31:25 +01:00
|
|
|
ivl_drive_t drv0, drv1;
|
|
|
|
|
drive_from_link(net->pin(0), drv0, drv1);
|
|
|
|
|
const Nexus*nex = net->pin(0).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->pin_ = nex->t_cookie();
|
2004-12-11 03:31:25 +01:00
|
|
|
nexus_con_add(obj->pin_, obj, 0, drv0, drv1);
|
2002-01-06 04:15:43 +01:00
|
|
|
|
2013-07-28 03:19:26 +02:00
|
|
|
des_.consts.push_back(obj);
|
2001-09-01 03:57:31 +02:00
|
|
|
|
2008-02-14 03:10:12 +01:00
|
|
|
make_const_delays_(obj, net);
|
|
|
|
|
|
2000-10-13 05:39:27 +02:00
|
|
|
return true;
|
2000-08-14 06:39:56 +02:00
|
|
|
}
|
|
|
|
|
|
2005-07-07 18:22:49 +02:00
|
|
|
bool dll_target::net_literal(const NetLiteral*net)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
struct ivl_net_const_s *obj = new struct ivl_net_const_s;
|
|
|
|
|
|
|
|
|
|
obj->type = IVL_VT_REAL;
|
2011-02-07 04:47:11 +01:00
|
|
|
assert(net->scope());
|
|
|
|
|
obj->scope = find_scope(des_, net->scope());
|
|
|
|
|
FILE_NAME(obj, net);
|
2005-07-07 18:22:49 +02:00
|
|
|
obj->width_ = 1;
|
|
|
|
|
obj->signed_ = 1;
|
|
|
|
|
obj->b.real_value = net->value_real().as_double();
|
|
|
|
|
|
|
|
|
|
/* Connect to all the nexus objects. Note that the one-bit
|
|
|
|
|
case can be handled more efficiently without allocating
|
|
|
|
|
array space. */
|
|
|
|
|
|
|
|
|
|
ivl_drive_t drv0, drv1;
|
|
|
|
|
drive_from_link(net->pin(0), drv0, drv1);
|
|
|
|
|
const Nexus*nex = net->pin(0).nexus();
|
|
|
|
|
assert(nex->t_cookie());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->pin_ = nex->t_cookie();
|
2005-07-07 18:22:49 +02:00
|
|
|
nexus_con_add(obj->pin_, obj, 0, drv0, drv1);
|
|
|
|
|
|
2013-07-28 03:19:26 +02:00
|
|
|
des_.consts.push_back(obj);
|
2005-07-07 18:22:49 +02:00
|
|
|
|
2008-02-14 03:10:12 +01:00
|
|
|
make_const_delays_(obj, net);
|
|
|
|
|
|
2005-07-07 18:22:49 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-01 22:37:06 +01:00
|
|
|
void dll_target::net_probe(const NetEvProbe*)
|
2000-08-19 20:12:42 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void dll_target::scope(const NetScope*net)
|
|
|
|
|
{
|
2013-03-18 01:44:15 +01:00
|
|
|
if (net->parent()==0 && net->type()==NetScope::CLASS) {
|
2000-09-30 04:18:15 +02:00
|
|
|
|
2014-09-16 02:33:56 +02:00
|
|
|
if (debug_emit) {
|
|
|
|
|
cerr << "dll_target::scope: "
|
|
|
|
|
<< "Add class " << scope_path(net)
|
|
|
|
|
<< " as a root scope." << endl;
|
|
|
|
|
}
|
2013-03-18 01:44:15 +01:00
|
|
|
add_root(net);
|
|
|
|
|
|
|
|
|
|
} if (net->parent() == 0) {
|
|
|
|
|
|
|
|
|
|
// Root scopes are already created...
|
2000-09-30 04:18:15 +02:00
|
|
|
|
|
|
|
|
} else {
|
2007-06-02 05:42:12 +02:00
|
|
|
perm_string sname = make_scope_name(net->fullname());
|
2013-03-18 01:44:15 +01:00
|
|
|
ivl_scope_t scop = new struct ivl_scope_s;
|
2008-10-20 19:06:04 +02:00
|
|
|
scop->name_ = sname;
|
|
|
|
|
FILE_NAME(scop, net);
|
|
|
|
|
scop->parent = find_scope(des_, net->parent());
|
|
|
|
|
assert(scop->parent);
|
2011-03-07 20:18:23 +01:00
|
|
|
scop->parent->children[net->fullname()] = scop;
|
2013-07-19 04:24:47 +02:00
|
|
|
scop->parent->child .push_back(scop);
|
2008-10-20 19:06:04 +02:00
|
|
|
scop->nlog_ = 0;
|
|
|
|
|
scop->log_ = 0;
|
|
|
|
|
scop->nevent_ = 0;
|
|
|
|
|
scop->event_ = 0;
|
|
|
|
|
scop->nlpm_ = 0;
|
|
|
|
|
scop->lpm_ = 0;
|
|
|
|
|
scop->def = 0;
|
|
|
|
|
make_scope_parameters(scop, net);
|
|
|
|
|
scop->time_precision = net->time_precision();
|
|
|
|
|
scop->time_units = net->time_unit();
|
|
|
|
|
scop->nattr = net->attr_cnt();
|
|
|
|
|
scop->attr = fill_in_attributes(net);
|
|
|
|
|
scop->is_auto = net->is_auto();
|
2009-05-21 23:41:58 +02:00
|
|
|
scop->is_cell = net->is_cell();
|
2000-09-30 04:18:15 +02:00
|
|
|
|
2001-01-15 01:47:01 +01:00
|
|
|
switch (net->type()) {
|
2013-02-17 23:42:07 +01:00
|
|
|
case NetScope::PACKAGE:
|
|
|
|
|
cerr << "?:?" << ": internal error: "
|
|
|
|
|
<< "Package scopes should not have parents." << endl;
|
2018-10-06 21:13:31 +02:00
|
|
|
// fallthrough
|
2001-01-15 01:47:01 +01:00
|
|
|
case NetScope::MODULE:
|
2008-10-20 19:06:04 +02:00
|
|
|
scop->type_ = IVL_SCT_MODULE;
|
|
|
|
|
scop->tname_ = net->module_name();
|
2012-06-04 21:43:33 +02:00
|
|
|
scop->ports = net->module_port_nets();
|
2011-03-07 20:18:23 +01:00
|
|
|
if (scop->ports > 0) {
|
|
|
|
|
scop->u_.net = new NetNet*[scop->ports];
|
|
|
|
|
for (unsigned idx = 0; idx < scop->ports; idx += 1) {
|
2012-06-04 21:43:33 +02:00
|
|
|
scop->u_.net[idx] = net->module_port_net(idx);
|
2011-03-07 20:18:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
2012-06-04 21:43:33 +02:00
|
|
|
scop->module_ports_info = net->module_port_info();
|
2001-01-15 01:47:01 +01:00
|
|
|
break;
|
2012-06-04 21:43:33 +02:00
|
|
|
|
2003-01-16 22:43:52 +01:00
|
|
|
case NetScope::TASK: {
|
|
|
|
|
const NetTaskDef*def = net->task_def();
|
|
|
|
|
if (def == 0) {
|
|
|
|
|
cerr << "?:?" << ": internal error: "
|
2008-10-20 19:06:04 +02:00
|
|
|
<< "task " << scop->name_
|
2003-01-16 22:43:52 +01:00
|
|
|
<< " has no definition." << endl;
|
|
|
|
|
}
|
|
|
|
|
assert(def);
|
2008-10-20 19:06:04 +02:00
|
|
|
scop->type_ = IVL_SCT_TASK;
|
|
|
|
|
scop->tname_ = def->scope()->basename();
|
2003-01-16 22:43:52 +01:00
|
|
|
break;
|
|
|
|
|
}
|
2001-01-15 01:47:01 +01:00
|
|
|
case NetScope::FUNC:
|
2016-02-01 00:29:52 +01:00
|
|
|
fill_in_scope_function(scop, net);
|
2001-01-15 01:47:01 +01:00
|
|
|
break;
|
|
|
|
|
case NetScope::BEGIN_END:
|
2008-10-20 19:06:04 +02:00
|
|
|
scop->type_ = IVL_SCT_BEGIN;
|
|
|
|
|
scop->tname_ = scop->name_;
|
2001-01-15 01:47:01 +01:00
|
|
|
break;
|
|
|
|
|
case NetScope::FORK_JOIN:
|
2008-10-20 19:06:04 +02:00
|
|
|
scop->type_ = IVL_SCT_FORK;
|
|
|
|
|
scop->tname_ = scop->name_;
|
2001-01-15 01:47:01 +01:00
|
|
|
break;
|
2006-04-10 02:37:42 +02:00
|
|
|
case NetScope::GENBLOCK:
|
2008-10-20 19:06:04 +02:00
|
|
|
scop->type_ = IVL_SCT_GENERATE;
|
|
|
|
|
scop->tname_ = scop->name_;
|
2006-04-10 02:37:42 +02:00
|
|
|
break;
|
2013-03-15 04:08:32 +01:00
|
|
|
case NetScope::CLASS:
|
|
|
|
|
assert(0);
|
|
|
|
|
break;
|
2001-01-15 01:47:01 +01:00
|
|
|
}
|
2011-03-07 20:18:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
2001-01-15 01:47:01 +01:00
|
|
|
|
2011-03-07 20:18:23 +01:00
|
|
|
void dll_target::convert_module_ports(const NetScope*net)
|
|
|
|
|
{
|
|
|
|
|
ivl_scope_t scop = find_scope(des_, net);
|
|
|
|
|
if (scop->ports > 0) {
|
|
|
|
|
NetNet**nets = scop->u_.net;
|
|
|
|
|
scop->u_.nex = new ivl_nexus_t[scop->ports];
|
|
|
|
|
for (unsigned idx = 0; idx < scop->ports; idx += 1) {
|
|
|
|
|
ivl_signal_t sig = find_signal(des_, nets[idx]);
|
|
|
|
|
scop->u_.nex[idx] = nexus_sig_make(sig, 0);
|
|
|
|
|
}
|
2011-03-22 18:58:18 +01:00
|
|
|
delete [] nets;
|
2000-09-30 04:18:15 +02:00
|
|
|
}
|
2000-08-27 17:51:50 +02:00
|
|
|
}
|
2000-08-19 20:12:42 +02:00
|
|
|
|
2000-08-27 17:51:50 +02:00
|
|
|
void dll_target::signal(const NetNet*net)
|
|
|
|
|
{
|
2000-10-08 06:01:54 +02:00
|
|
|
ivl_signal_t obj = new struct ivl_signal_s;
|
|
|
|
|
|
2003-03-06 01:28:41 +01:00
|
|
|
obj->name_ = net->name();
|
2000-10-07 01:46:50 +02:00
|
|
|
|
|
|
|
|
/* Attach the signal to the ivl_scope_t object that contains
|
|
|
|
|
it. This involves growing the sigs_ array in the scope
|
|
|
|
|
object, or creating the sigs_ array if this is the first
|
|
|
|
|
signal. */
|
2001-10-19 23:53:24 +02:00
|
|
|
obj->scope_ = find_scope(des_, net->scope());
|
2000-10-07 01:46:50 +02:00
|
|
|
assert(obj->scope_);
|
2011-02-07 04:47:11 +01:00
|
|
|
FILE_NAME(obj, net);
|
2000-10-07 01:46:50 +02:00
|
|
|
|
2012-07-14 03:41:41 +02:00
|
|
|
obj->scope_->sigs_.push_back(obj);
|
2000-10-15 06:46:23 +02:00
|
|
|
|
2000-10-08 06:01:54 +02:00
|
|
|
|
2003-01-30 17:23:07 +01:00
|
|
|
/* Save the primitive properties of the signal in the
|
2000-10-07 01:46:50 +02:00
|
|
|
ivl_signal_t object. */
|
|
|
|
|
|
2012-02-11 02:17:59 +01:00
|
|
|
{ size_t idx = 0;
|
2012-09-30 00:13:45 +02:00
|
|
|
vector<netrange_t>::const_iterator cur;
|
2012-02-11 02:17:59 +01:00
|
|
|
obj->packed_dims.resize(net->packed_dims().size());
|
|
|
|
|
for (cur = net->packed_dims().begin(), idx = 0
|
|
|
|
|
; cur != net->packed_dims().end() ; ++cur, idx += 1) {
|
|
|
|
|
obj->packed_dims[idx] = *cur;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-02-07 02:47:53 +01:00
|
|
|
|
2012-09-23 18:28:49 +02:00
|
|
|
obj->net_type = net->net_type();
|
2007-12-28 02:34:12 +01:00
|
|
|
obj->local_ = net->local_flag()? 1 : 0;
|
2011-08-06 01:10:41 +02:00
|
|
|
obj->forced_net_ = (net->type() != NetNet::REG) &&
|
|
|
|
|
(net->peek_lref() > 0) ? 1 : 0;
|
2008-11-02 17:10:41 +01:00
|
|
|
obj->discipline = net->get_discipline();
|
2000-10-07 01:46:50 +02:00
|
|
|
|
2012-05-26 00:58:29 +02:00
|
|
|
obj->array_dimensions_ = net->unpacked_dimensions();
|
|
|
|
|
assert(obj->array_dimensions_ == net->unpacked_dimensions());
|
2007-04-02 03:12:34 +02:00
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
switch (net->port_type()) {
|
|
|
|
|
|
|
|
|
|
case NetNet::PINPUT:
|
|
|
|
|
obj->port_ = IVL_SIP_INPUT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NetNet::POUTPUT:
|
|
|
|
|
obj->port_ = IVL_SIP_OUTPUT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NetNet::PINOUT:
|
|
|
|
|
obj->port_ = IVL_SIP_INOUT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
obj->port_ = IVL_SIP_NONE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-04 21:43:33 +02:00
|
|
|
obj->module_port_index_ = net->get_module_port_index();
|
|
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
switch (net->type()) {
|
|
|
|
|
|
|
|
|
|
case NetNet::REG:
|
|
|
|
|
obj->type_ = IVL_SIT_REG;
|
|
|
|
|
break;
|
|
|
|
|
|
2005-02-13 02:15:07 +01:00
|
|
|
/* The SUPPLY0/1 net types are replaced with pulldown/up
|
|
|
|
|
by elaborate. They should not make it here. */
|
2000-10-07 01:46:50 +02:00
|
|
|
case NetNet::SUPPLY0:
|
2005-02-13 02:15:07 +01:00
|
|
|
assert(0);
|
2000-10-07 01:46:50 +02:00
|
|
|
break;
|
|
|
|
|
case NetNet::SUPPLY1:
|
2005-02-13 02:15:07 +01:00
|
|
|
assert(0);
|
2000-10-07 01:46:50 +02:00
|
|
|
break;
|
|
|
|
|
|
2010-08-12 20:21:36 +02:00
|
|
|
/* We will convert this to a TRI after we check that there
|
|
|
|
|
is only one driver. */
|
2010-10-08 05:13:11 +02:00
|
|
|
case NetNet::UNRESOLVED_WIRE:
|
2010-08-12 20:21:36 +02:00
|
|
|
obj->type_ = IVL_SIT_UWIRE;
|
|
|
|
|
break;
|
|
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
case NetNet::TRI:
|
2003-07-30 03:13:28 +02:00
|
|
|
case NetNet::WIRE:
|
|
|
|
|
case NetNet::IMPLICIT:
|
2000-10-07 01:46:50 +02:00
|
|
|
obj->type_ = IVL_SIT_TRI;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NetNet::TRI0:
|
|
|
|
|
obj->type_ = IVL_SIT_TRI0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NetNet::TRI1:
|
|
|
|
|
obj->type_ = IVL_SIT_TRI1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NetNet::TRIAND:
|
2003-07-30 03:13:28 +02:00
|
|
|
case NetNet::WAND:
|
2000-10-07 01:46:50 +02:00
|
|
|
obj->type_ = IVL_SIT_TRIAND;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case NetNet::TRIOR:
|
|
|
|
|
case NetNet::WOR:
|
2003-07-30 03:13:28 +02:00
|
|
|
obj->type_ = IVL_SIT_TRIOR;
|
2000-10-07 01:46:50 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
obj->type_ = IVL_SIT_NONE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2006-11-10 06:44:44 +01:00
|
|
|
/* Initialize the path fields to be filled in later. */
|
2006-09-28 02:29:49 +02:00
|
|
|
obj->npath = 0;
|
2006-11-10 06:44:44 +01:00
|
|
|
obj->path = 0;
|
2006-09-23 06:57:19 +02:00
|
|
|
|
2002-05-26 03:39:02 +02:00
|
|
|
obj->nattr = net->attr_cnt();
|
2002-05-24 06:36:23 +02:00
|
|
|
obj->attr = fill_in_attributes(net);
|
|
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
/* Get the nexus objects for all the pins of the signal. If
|
|
|
|
|
the signal has only one pin, then write the single
|
|
|
|
|
ivl_nexus_t object into n.pin_. Otherwise, make an array of
|
|
|
|
|
ivl_nexus_t cookies.
|
|
|
|
|
|
|
|
|
|
When I create an ivl_nexus_t object, store it in the
|
|
|
|
|
t_cookie of the Nexus object so that I find it again when I
|
|
|
|
|
next encounter the nexus. */
|
|
|
|
|
|
2012-05-26 00:58:29 +02:00
|
|
|
if (obj->array_dimensions_ == 1) {
|
2012-05-26 01:32:12 +02:00
|
|
|
const vector<netrange_t>& dims = net->unpacked_dims();
|
2012-07-14 03:41:41 +02:00
|
|
|
if (dims[0].get_msb() < dims[0].get_lsb()) {
|
|
|
|
|
obj->array_base = dims[0].get_msb();
|
2012-05-26 00:58:29 +02:00
|
|
|
obj->array_addr_swapped = false;
|
|
|
|
|
} else {
|
2012-07-14 03:41:41 +02:00
|
|
|
obj->array_base = dims[0].get_lsb();
|
2012-05-26 00:58:29 +02:00
|
|
|
obj->array_addr_swapped = true;
|
|
|
|
|
}
|
|
|
|
|
obj->array_words = net->unpacked_count();
|
|
|
|
|
} else {
|
|
|
|
|
// The back-end API doesn't yet support multi-dimension
|
|
|
|
|
// unpacked arrays, so just report the canonical dimensions.
|
|
|
|
|
obj->array_base = 0;
|
|
|
|
|
obj->array_words = net->unpacked_count();
|
|
|
|
|
obj->array_addr_swapped = 0;
|
|
|
|
|
}
|
2009-03-06 02:44:11 +01:00
|
|
|
|
2011-12-11 19:28:04 +01:00
|
|
|
ivl_assert(*net, obj->array_words == net->pin_count());
|
2009-03-06 02:44:11 +01:00
|
|
|
if (debug_optimizer && obj->array_words > 1000) cerr << "debug: "
|
|
|
|
|
"t-dll creating nexus array " << obj->array_words << " long" << endl;
|
2009-03-11 17:18:30 +01:00
|
|
|
if (obj->array_words > 1 && net->pins_are_virtual()) {
|
|
|
|
|
obj->pins = NULL;
|
|
|
|
|
if (debug_optimizer && obj->array_words > 1000) cerr << "debug: "
|
|
|
|
|
"t-dll used NULL for big nexus array" << endl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2007-01-16 06:44:14 +01:00
|
|
|
if (obj->array_words > 1)
|
|
|
|
|
obj->pins = new ivl_nexus_t[obj->array_words];
|
2000-10-07 01:46:50 +02:00
|
|
|
|
2007-01-16 06:44:14 +01:00
|
|
|
for (unsigned idx = 0 ; idx < obj->array_words ; idx += 1) {
|
2004-12-11 03:31:25 +01:00
|
|
|
|
2009-03-06 02:44:11 +01:00
|
|
|
const Nexus*nex = net->pins_are_virtual() ? 0 : net->pin(idx).nexus();
|
2009-01-08 07:07:08 +01:00
|
|
|
if (nex == 0) {
|
|
|
|
|
// Special case: This pin is connected to
|
|
|
|
|
// nothing. This can happen, for example, if the
|
|
|
|
|
// variable is only used in behavioral
|
|
|
|
|
// code. Create a stub nexus.
|
|
|
|
|
ivl_nexus_t tmp = nexus_sig_make(obj, idx);
|
|
|
|
|
tmp->nexus_ = nex;
|
|
|
|
|
tmp->name_ = 0;
|
|
|
|
|
if (obj->array_words > 1)
|
|
|
|
|
obj->pins[idx] = tmp;
|
|
|
|
|
else
|
|
|
|
|
obj->pin = tmp;
|
|
|
|
|
} else if (nex->t_cookie()) {
|
2007-01-16 06:44:14 +01:00
|
|
|
if (obj->array_words > 1) {
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->pins[idx] = nex->t_cookie();
|
2007-01-16 06:44:14 +01:00
|
|
|
nexus_sig_add(obj->pins[idx], obj, idx);
|
|
|
|
|
} else {
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->pin = nex->t_cookie();
|
2007-01-16 06:44:14 +01:00
|
|
|
nexus_sig_add(obj->pin, obj, idx);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ivl_nexus_t tmp = nexus_sig_make(obj, idx);
|
2007-03-26 18:51:48 +02:00
|
|
|
tmp->nexus_ = nex;
|
|
|
|
|
tmp->name_ = 0;
|
2007-01-16 06:44:14 +01:00
|
|
|
nex->t_cookie(tmp);
|
|
|
|
|
if (obj->array_words > 1)
|
|
|
|
|
obj->pins[idx] = tmp;
|
|
|
|
|
else
|
|
|
|
|
obj->pin = tmp;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-03-06 02:44:11 +01:00
|
|
|
if (debug_optimizer && obj->array_words > 1000) cerr << "debug: t-dll done with big nexus array" << endl;
|
2000-08-19 20:12:42 +02:00
|
|
|
}
|
|
|
|
|
|
2006-11-10 06:44:44 +01:00
|
|
|
bool dll_target::signal_paths(const NetNet*net)
|
|
|
|
|
{
|
|
|
|
|
/* Nothing to do if there are no paths for this signal. */
|
|
|
|
|
if (net->delay_paths() == 0)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
ivl_signal_t obj = find_signal(des_, net);
|
|
|
|
|
assert(obj);
|
|
|
|
|
|
|
|
|
|
/* We cannot have already set up the paths for this signal. */
|
|
|
|
|
assert(obj->npath == 0);
|
|
|
|
|
assert(obj->path == 0);
|
|
|
|
|
|
|
|
|
|
/* Figure out how many paths there really are. */
|
|
|
|
|
for (unsigned idx = 0 ; idx < net->delay_paths() ; idx += 1) {
|
|
|
|
|
const NetDelaySrc*src = net->delay_path(idx);
|
2007-03-01 07:19:38 +01:00
|
|
|
obj->npath += src->src_count();
|
2006-11-10 06:44:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
obj->path = new struct ivl_delaypath_s[obj->npath];
|
|
|
|
|
|
|
|
|
|
unsigned ptr = 0;
|
|
|
|
|
for (unsigned idx = 0 ; idx < net->delay_paths() ; idx += 1) {
|
|
|
|
|
const NetDelaySrc*src = net->delay_path(idx);
|
|
|
|
|
|
2007-03-01 07:19:38 +01:00
|
|
|
/* If this path has a condition, then hook it up. */
|
|
|
|
|
ivl_nexus_t path_condit = 0;
|
2008-04-29 04:00:29 +02:00
|
|
|
if (src->has_condit()) {
|
2007-03-01 07:19:38 +01:00
|
|
|
const Nexus*nt = src->condit_pin().nexus();
|
2007-03-26 20:17:50 +02:00
|
|
|
path_condit = nt->t_cookie();
|
2007-03-01 07:19:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (unsigned pin = 0; pin < src->src_count(); pin += 1) {
|
|
|
|
|
const Nexus*nex = src->src_pin(pin).nexus();
|
2006-11-10 06:44:44 +01:00
|
|
|
if (! nex->t_cookie()) {
|
2007-12-20 18:31:01 +01:00
|
|
|
cerr << src->get_fileline() << ": internal error: "
|
2006-11-10 06:44:44 +01:00
|
|
|
<< "No signal connected to pin " << pin
|
|
|
|
|
<< " of delay path to " << net->name()
|
|
|
|
|
<< "." << endl;
|
|
|
|
|
}
|
|
|
|
|
assert(nex->t_cookie());
|
2007-11-01 05:39:29 +01:00
|
|
|
obj->path[ptr].scope = lookup_scope_(src->scope());
|
2007-03-26 20:17:50 +02:00
|
|
|
obj->path[ptr].src = nex->t_cookie();
|
2007-03-01 07:19:38 +01:00
|
|
|
obj->path[ptr].condit = path_condit;
|
2008-04-29 04:00:29 +02:00
|
|
|
obj->path[ptr].conditional = src->is_condit();
|
2007-03-02 07:13:22 +01:00
|
|
|
obj->path[ptr].posedge = src->is_posedge();
|
|
|
|
|
obj->path[ptr].negedge = src->is_negedge();
|
2006-11-10 06:44:44 +01:00
|
|
|
for (unsigned pe = 0 ; pe < 12 ; pe += 1) {
|
|
|
|
|
obj->path[ptr].delay[pe] = src->get_delay(pe);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ptr += 1;
|
|
|
|
|
}
|
2007-03-01 07:19:38 +01:00
|
|
|
|
2006-11-10 06:44:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2008-09-08 06:54:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
void dll_target::test_version(const char*target_name)
|
|
|
|
|
{
|
|
|
|
|
dll_ = ivl_dlopen(target_name);
|
|
|
|
|
|
|
|
|
|
if ((dll_ == 0) && (target_name[0] != '/')) {
|
|
|
|
|
size_t len = strlen(basedir) + 1 + strlen(target_name) + 1;
|
|
|
|
|
char*tmp = new char[len];
|
|
|
|
|
sprintf(tmp, "%s/%s", basedir, target_name);
|
|
|
|
|
dll_ = ivl_dlopen(tmp);
|
|
|
|
|
delete[]tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dll_ == 0) {
|
|
|
|
|
cout << "\n\nUnable to load " << target_name
|
|
|
|
|
<< " for version details." << endl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
target_query_f target_query = (target_query_f)ivl_dlsym(dll_, LU "target_query" TU);
|
|
|
|
|
if (target_query == 0) {
|
|
|
|
|
cerr << "Target " << target_name
|
|
|
|
|
<< " has no version hooks." << endl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char*version_string = (*target_query) ("version");
|
|
|
|
|
if (version_string == 0) {
|
|
|
|
|
cerr << "Target " << target_name
|
|
|
|
|
<< " has no version string" << endl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cout << target_name << ": " << version_string << endl;
|
|
|
|
|
}
|