Add missing support for task ports in ivl interface

It was documented that ivl_scope_port(s)() could be used with tasks,
but the code did not support this. This patch adds that functionality
as documented. It also removes the documentation for ivl_lval_mem()
since that function no longer exists.
This commit is contained in:
Cary R 2011-01-10 09:23:36 -08:00 committed by Stephen Williams
parent d4a97b4a9c
commit d5352ca47a
5 changed files with 19 additions and 22 deletions

View File

@ -1,7 +1,7 @@
#ifndef __ivl_target_H
#define __ivl_target_H
/*
* Copyright (c) 2000-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -1353,11 +1353,6 @@ extern const char*ivl_lpm_string(ivl_lpm_t net);
*
* (Should this be combined with ivl_lval_idx? -Ed)
*
* ivl_lval_mem (deprecated)
* If the l-value is a memory, this method returns an
* ivl_memory_t that represents that memory. Otherwise, it
* returns 0.
*
* ivl_lval_sig
* If the l-value is a variable, this method returns the signal
* object that is the target of the assign.
@ -1383,13 +1378,6 @@ extern const char*ivl_lpm_string(ivl_lpm_t net);
* The ivl_lval_part_off is the canonical base of a part or
* bit select.
*
* - Memory words (Replace this with Array words below)
* If the l-value is a memory word, the ivl_lval_mem function returns
* a non-nil value. The ivl_lval_idx function will return an
* expression that calculates an address for the memory. The compiler
* will assure that the ivl_lval_width will exactly match the
* ivl_memory_width of the memory word.
*
* - Array words
* If the l-value is an array, then ivl_lval_idx function will return
* an expression that calculates the address of the array word. If

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -2545,7 +2545,7 @@ unsigned NetTaskDef::port_count() const
return ports_.count();
}
NetNet* NetTaskDef::port(unsigned idx)
NetNet* NetTaskDef::port(unsigned idx) const
{
assert(idx < ports_.count());
return ports_[idx];

View File

@ -1,7 +1,7 @@
#ifndef __netlist_H
#define __netlist_H
/*
* Copyright (c) 1998-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -3088,7 +3088,7 @@ class NetTaskDef {
const NetProc*proc() const;
unsigned port_count() const;
NetNet*port(unsigned idx);
NetNet*port(unsigned idx) const;
void dump(ostream&, unsigned) const;
DelayType delay_type() const;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -1851,14 +1851,16 @@ extern "C" ivl_scope_t ivl_scope_parent(ivl_scope_t net)
extern "C" unsigned ivl_scope_ports(ivl_scope_t net)
{
assert(net);
assert(net->type_ == IVL_SCT_FUNCTION);
return net->ports;
if (net->type_ == IVL_SCT_FUNCTION ||
net->type_ == IVL_SCT_TASK) return net->ports;
return 0;
}
extern "C" ivl_signal_t ivl_scope_port(ivl_scope_t net, unsigned idx)
{
assert(net);
assert(net->type_ == IVL_SCT_FUNCTION);
assert(net->type_ == IVL_SCT_FUNCTION ||
net->type_ == IVL_SCT_TASK);
assert(idx < net->ports);
return net->port[idx];
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -86,6 +86,13 @@ void dll_target::task_def(const NetScope*net)
scop->def = stmt_cur_;
stmt_cur_ = 0;
scop->ports = def->port_count();
if (scop->ports > 0) {
scop->port = new ivl_signal_t[scop->ports];
for (unsigned idx = 0 ; idx < scop->ports ; idx += 1)
scop->port[idx] = find_signal(des_, def->port(idx));
}
}
bool dll_target::func_def(const NetScope*net)