Skip to content

Commit

Permalink
Route messages according to routing tables.
Browse files Browse the repository at this point in the history
We now must run the first ELF in the XE in order to configure the routing.
  • Loading branch information
Richard Osborne committed May 15, 2012
1 parent 294333d commit cc90356
Show file tree
Hide file tree
Showing 24 changed files with 862 additions and 178 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ add_executable(axe
Token.h
SSwitch.h
SSwitch.cpp
SSwitchCtrlRegs.h
SSwitchCtrlRegs.cpp
WaveformTracer.h
WaveformTracer.cpp
UartRx.h
Expand Down
10 changes: 6 additions & 4 deletions Chanend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ bool Chanend::openRoute()
{
if (inPacket)
return true;
dest = getOwner().getParent().getChanendDest(destID);
if (!dest) {
// TODO if dest in unset should give a link error exception.
junkPacket = true;
Expand All @@ -86,11 +87,11 @@ bool Chanend::setData(Thread &thread, uint32_t value, ticks_t time)
updateOwner(thread);
if (inPacket)
return false;
ResourceID destID(value);
if (destID.type() != RES_TYPE_CHANEND &&
destID.type() != RES_TYPE_CONFIG)
ResourceID id(value);
if (id.type() != RES_TYPE_CHANEND &&
id.type() != RES_TYPE_CONFIG)
return false;
dest = thread.getParent().getChanendDest(destID);
destID = value;
return true;
}

Expand Down Expand Up @@ -159,6 +160,7 @@ outct(Thread &thread, uint8_t value, ticks_t time)
dest->receiveCtrlToken(time, value);
if (value == CT_END || value == CT_PAUSE) {
inPacket = false;
dest = 0;
}
return CONTINUE;
}
Expand Down
5 changes: 4 additions & 1 deletion Chanend.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@

class Chanend : public EventableResource, public ChanEndpoint {
private:
/// The destination channel end.
// The destination resource ID.
uint32_t destID;
/// The destination channel end. Only valid when in the the middle of a
/// packet.
ChanEndpoint *dest;
/// Input buffer.
typedef ring_buffer<Token, CHANEND_BUFFER_SIZE> TokenBuffer;
Expand Down
86 changes: 73 additions & 13 deletions ConfigSchema.rng
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
<ref name="anyAttributes"/>
<interleave>
<ref name="Nodes"/>
<ref name="Connections"/>
<ref name="JtagChain"/>
<zeroOrMore>
<element>
<anyName>
<except>
<name>Nodes</name>
<name>Connections</name>
<name>JtagChain</name>
</except>
</anyName>
Expand Down Expand Up @@ -48,6 +50,45 @@
</element>
</define>

<define name="Connections">
<element name="Connections">
<ref name="anyAttributes"/>
<interleave>
<zeroOrMore>
<ref name="SLink"/>
</zeroOrMore>
<zeroOrMore>
<element>
<anyName>
<except>
<name>SLink</name>
</except>
</anyName>
<ref name="anyContent"/>
</element>
</zeroOrMore>
</interleave>
</element>
</define>

<define name="SLink">
<element name="SLink">
<attribute name="end1"/>
<attribute name="end2"/>
<zeroOrMore>
<attribute>
<anyName>
<except>
<name>end1</name>
<name>end2</name>
</except>
</anyName>
</attribute>
</zeroOrMore>
<ref name="anyElements"/>
</element>
</define>

<define name="JtagChain">
<element name="JtagChain">
<ref name="anyAttributes"/>
Expand Down Expand Up @@ -82,12 +123,14 @@
<interleave>
<oneOrMore>
<ref name="Processor"/>
</oneOrMore>
</oneOrMore>
<ref name="Switch"/>
<zeroOrMore>
<element>
<anyName>
<except>
<name>Processor</name>
<name>Switch</name>
</except>
</anyName>
<ref name="anyContent"/>
Expand Down Expand Up @@ -133,25 +176,37 @@
</element>
</define>

<define name="anyElement">
<element>
<anyName/>
<ref name="anyContent"/>
<define name="Switch">
<element name="Switch">
<attribute name="sLinks">
<ref name="numberAnyBase"/>
</attribute>
<zeroOrMore>
<attribute>
<anyName>
<except>
<name>sLinks</name>
</except>
</anyName>
</attribute>
</zeroOrMore>
<ref name="anyElements"/>
</element>
</define>

<define name="anyContent">
<define name="anyElements">
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="anyElement"/>
</choice>
<ref name="anyElement"/>
</zeroOrMore>
</define>

<define name="anyElement">
<element>
<anyName/>
<ref name="anyContent"/>
</element>
</define>

<define name="anyAttributes">
<zeroOrMore>
<attribute>
Expand All @@ -160,6 +215,11 @@
</zeroOrMore>
</define>

<define name="anyContent">
<ref name="anyElements"/>
<ref name="anyAttributes"/>
</define>

<define name="numberAnyBase">
<data type="string">
<param name="pattern">([0-9]+|0x[0-9a-fA-F]+|0[0-8]+)</param>
Expand Down
28 changes: 16 additions & 12 deletions Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,22 +258,26 @@ initCache(OPCODE_TYPE decode, OPCODE_TYPE illegalPC,
decodeOpcode = decode;
}

void Core::resetCaches()
{
uint32_t ramEnd = ram_base + (1 << ramSizeLog2);
for (unsigned address = ram_base; address < ramEnd; address += 4) {
invalidateWord(address);
}
}

bool Core::getLocalChanendDest(ResourceID ID, ChanEndpoint *&result)
{
assert(ID.isChanendOrConfig());
if (ID.isConfig()) {
switch (ID.num()) {
case RES_CONFIG_SSCTRL:
if (parent->hasMatchingNodeID(ID)) {
result = parent->getSSwitch();
return true;
}
break;
case RES_CONFIG_PSCTRL:
// TODO.
assert(0);
result = 0;
return true;
case RES_CONFIG_SSCTRL:
return false;
case RES_CONFIG_PSCTRL:
// TODO.
assert(0);
result = 0;
return true;
}
} else {
if (ID.node() == getCoreID()) {
Expand All @@ -298,7 +302,7 @@ ChanEndpoint *Core::getChanendDest(ResourceID ID)
// Try to lookup locally first.
if (getLocalChanendDest(ID, result))
return result;
return parent->getParent()->getChanendDest(ID);
return parent->getChanendDest(ID);
}

void Core::finalize()
Expand Down
2 changes: 2 additions & 0 deletions Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ class Core {
OPCODE_TYPE illegalPCThread, OPCODE_TYPE runJit,
OPCODE_TYPE interpretOne);

void resetCaches();

void runJIT(uint32_t jitPc);

uint32_t getRamSize() const { return 1 << ramSizeLog2; }
Expand Down
Loading

0 comments on commit cc90356

Please sign in to comment.