Add support for getting the original port names of a UDP definition.
This patch adds support to the compiler/ivl interface for getting the original UDP definition port names. ivl_udp_port() was added to get this information.
This commit is contained in:
parent
757611b8e9
commit
53abd7a5b2
1
ivl.def
1
ivl.def
|
|
@ -288,6 +288,7 @@ ivl_udp_file
|
||||||
ivl_udp_lineno
|
ivl_udp_lineno
|
||||||
ivl_udp_name
|
ivl_udp_name
|
||||||
ivl_udp_nin
|
ivl_udp_nin
|
||||||
|
ivl_udp_port
|
||||||
ivl_udp_row
|
ivl_udp_row
|
||||||
ivl_udp_rows
|
ivl_udp_rows
|
||||||
ivl_udp_sequ
|
ivl_udp_sequ
|
||||||
|
|
|
||||||
|
|
@ -1040,6 +1040,7 @@ extern unsigned ivl_udp_rows(ivl_udp_t net);
|
||||||
extern const char* ivl_udp_name(ivl_udp_t net);
|
extern const char* ivl_udp_name(ivl_udp_t net);
|
||||||
extern const char* ivl_udp_file(ivl_udp_t net);
|
extern const char* ivl_udp_file(ivl_udp_t net);
|
||||||
extern unsigned ivl_udp_lineno(ivl_udp_t net);
|
extern unsigned ivl_udp_lineno(ivl_udp_t net);
|
||||||
|
extern const char* ivl_udp_port(ivl_udp_t net, unsigned idx);
|
||||||
|
|
||||||
extern const char* ivl_lpm_file(ivl_lpm_t net);
|
extern const char* ivl_lpm_file(ivl_lpm_t net);
|
||||||
extern unsigned ivl_lpm_lineno(ivl_lpm_t net);
|
extern unsigned ivl_lpm_lineno(ivl_lpm_t net);
|
||||||
|
|
|
||||||
11
net_udp.cc
11
net_udp.cc
|
|
@ -79,3 +79,14 @@ char NetUDP::get_initial() const
|
||||||
assert(0);
|
assert(0);
|
||||||
return 'x';
|
return 'x';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned NetUDP::port_count() const
|
||||||
|
{
|
||||||
|
return udp->ports.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
string NetUDP::port_name(unsigned idx) const
|
||||||
|
{
|
||||||
|
assert(idx < udp->ports.count());
|
||||||
|
return udp->ports[idx];
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@
|
||||||
# include "LineInfo.h"
|
# include "LineInfo.h"
|
||||||
# include "svector.h"
|
# include "svector.h"
|
||||||
# include "Attrib.h"
|
# include "Attrib.h"
|
||||||
|
# include "PUdp.h"
|
||||||
|
|
||||||
#ifdef HAVE_IOSFWD
|
#ifdef HAVE_IOSFWD
|
||||||
# include <iosfwd>
|
# include <iosfwd>
|
||||||
|
|
@ -2144,7 +2145,6 @@ class NetUReduce : public NetNode {
|
||||||
* 1 are listed.
|
* 1 are listed.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "PUdp.h"
|
|
||||||
|
|
||||||
class NetUDP : public NetNode {
|
class NetUDP : public NetNode {
|
||||||
|
|
||||||
|
|
@ -2169,6 +2169,9 @@ class NetUDP : public NetNode {
|
||||||
unsigned udp_lineno() const { return udp->get_lineno(); }
|
unsigned udp_lineno() const { return udp->get_lineno(); }
|
||||||
char get_initial() const;
|
char get_initial() const;
|
||||||
|
|
||||||
|
unsigned port_count() const;
|
||||||
|
string port_name(unsigned idx) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable unsigned table_idx;
|
mutable unsigned table_idx;
|
||||||
PUdp *udp;
|
PUdp *udp;
|
||||||
|
|
|
||||||
|
|
@ -867,6 +867,14 @@ extern "C" char ivl_udp_init(ivl_udp_t net)
|
||||||
return net->init;
|
return net->init;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" const char* ivl_udp_port(ivl_udp_t net, unsigned idx)
|
||||||
|
{
|
||||||
|
assert(idx <= net->nin);
|
||||||
|
assert(net->ports);
|
||||||
|
assert(net->ports[idx].c_str());
|
||||||
|
return net->ports[idx].c_str();
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" const char* ivl_udp_row(ivl_udp_t net, unsigned idx)
|
extern "C" const char* ivl_udp_row(ivl_udp_t net, unsigned idx)
|
||||||
{
|
{
|
||||||
assert(idx < net->nrows);
|
assert(idx < net->nrows);
|
||||||
|
|
|
||||||
60
t-dll.cc
60
t-dll.cc
|
|
@ -1270,38 +1270,36 @@ void dll_target::udp(const NetUDP*net)
|
||||||
static map<perm_string,ivl_udp_t> udps;
|
static map<perm_string,ivl_udp_t> udps;
|
||||||
ivl_udp_t u;
|
ivl_udp_t u;
|
||||||
|
|
||||||
if (udps.find(net->udp_name()) != udps.end())
|
if (udps.find(net->udp_name()) != udps.end()) {
|
||||||
{
|
u = udps[net->udp_name()];
|
||||||
u = udps[net->udp_name()];
|
} else {
|
||||||
}
|
u = new struct ivl_udp_s;
|
||||||
else
|
u->nrows = net->rows();
|
||||||
{
|
u->table = (ivl_udp_s::ccharp_t*)malloc((u->nrows+1)*sizeof(char*));
|
||||||
u = new struct ivl_udp_s;
|
u->table[u->nrows] = 0x0;
|
||||||
u->nrows = net->rows();
|
u->nin = net->nin();
|
||||||
u->table = (ivl_udp_s::ccharp_t*)malloc((u->nrows+1)*sizeof(char*));
|
u->sequ = net->is_sequential();
|
||||||
u->table[u->nrows] = 0x0;
|
u->file = net->udp_file();
|
||||||
u->nin = net->nin();
|
u->lineno = net->udp_lineno();
|
||||||
u->sequ = net->is_sequential();
|
if (u->sequ) u->init = net->get_initial();
|
||||||
u->file = net->udp_file();
|
else u->init = 'x';
|
||||||
u->lineno = net->udp_lineno();
|
u->name = net->udp_name();
|
||||||
if (u->sequ)
|
string inp;
|
||||||
u->init = net->get_initial();
|
char out;
|
||||||
else
|
unsigned int i = 0;
|
||||||
u->init = 'x';
|
if (net->first(inp, out)) do {
|
||||||
u->name = net->udp_name();
|
string tt = inp+out;
|
||||||
string inp;
|
u->table[i++] = strings_.add(tt.c_str());
|
||||||
char out;
|
} while (net->next(inp, out));
|
||||||
unsigned int i = 0;
|
assert(i==u->nrows);
|
||||||
if (net->first(inp, out))
|
assert((u->nin + 1) == net->port_count());
|
||||||
do
|
u->ports = new string [u->nin + 1];
|
||||||
{
|
for(unsigned idx = 0; idx <= u->nin; idx += 1) {
|
||||||
string tt = inp+out;
|
u->ports[idx] = net->port_name(idx);
|
||||||
u->table[i++] = strings_.add(tt.c_str());
|
}
|
||||||
} while (net->next(inp, out));
|
|
||||||
assert(i==u->nrows);
|
|
||||||
|
|
||||||
udps[net->udp_name()] = u;
|
udps[net->udp_name()] = u;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj->udp = u;
|
obj->udp = u;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue