...
 
Commits (1)
......@@ -89,8 +89,8 @@ int System::attach(Entity* e, const char* n, unsigned short k, char c)
name += std::to_string(i);
name += "]";
}
#if 1
std::cout << name << std::endl;
#ifdef DEBUG
std::cout << name << " <- " << e->name() << std::endl;
#endif
auto a = m.find(name);
if(a==m.end())
......
......@@ -411,20 +411,28 @@ namespace TRC
std::string *n;
Entity(const char* s)
Entity(const char *s)
{
sys = System::getInstance();
n = new std::string(s);
sys = System::getInstance();
n = new std::string(s);
}
virtual ~Entity()
{
delete n;
delete n;
}
const std::string & name()
{
return *n;
return *n;
}
const std::string name(const char* s)
{
std::string n2(*n);
n2 += ".";
n2 += s;
return n2;
}
int at(const char* n, unsigned short k = 1, char c = NC)
......
......@@ -14,6 +14,24 @@ class MyUnit : public Entity
Wire<8> net;
// outputs:
Signal sig;
// internal objects:
class InternalUnit : public Entity
{
public:
int i1;
InternalUnit(string s) : Entity(s.c_str())
{
i1 = at(".local");
}
void step()
{
}
}*u1,*u2;
public:
......@@ -22,6 +40,8 @@ class MyUnit : public Entity
i0 = at("bus",8,PULLUP);
i1 = at(".network",8);
i2 = at("single");
u1 = new InternalUnit(name("u1"));
u2 = new InternalUnit(name("u2"));
}
void step()
......