Skip to content

Commit d570ea5

Browse files
committed
[ESI][Runtime] Fix FIFO connections through cosim
When cosimulation endpoints are instantiated, they see the ValidReady converted signaling. This doesn't match what's in the manifest since the connection request type includes the FIFO signaling. So the gRPC string description of the endpoint doesn't match with the type ID from the manifest. "Fix" this by removing the sanity check.
1 parent 3cde45f commit d570ea5

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

frontends/PyCDE/integration_test/esi_test.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
# RUN: rm -rf %t
33
# RUN: mkdir %t && cd %t
44
# RUN: %PYTHON% %s %t 2>&1
5-
# RUN: esi-cosim.py -- %PYTHON% %S/test_software/esi_test.py cosim env
5+
# RUN: esi-cosim.py --source %t -- %PYTHON% %S/test_software/esi_test.py cosim env
66

77
import pycde
88
from pycde import (AppID, Clock, Module, Reset, modparams, generator)
99
from pycde.bsp import get_bsp
1010
from pycde.common import Constant, Input, Output
1111
from pycde.constructs import ControlReg, Reg, Wire
1212
from pycde.esi import ChannelService, FuncService, MMIO, MMIOReadWriteCmdType
13-
from pycde.types import (Bits, Channel, UInt)
13+
from pycde.types import (Bits, Channel, ChannelSignaling, UInt)
1414
from pycde.behavioral import If, Else, EndIf
1515
from pycde.handshake import Func
1616

@@ -26,16 +26,18 @@ class LoopbackInOutAdd(Module):
2626

2727
@generator
2828
def construct(ports):
29-
loopback = Wire(Channel(UInt(16)))
29+
loopback = Wire(Channel(UInt(16), signaling=ChannelSignaling.FIFO))
3030
args = FuncService.get_call_chans(AppID("add"),
3131
arg_type=UInt(24),
3232
result=loopback)
3333

3434
ready = Wire(Bits(1))
3535
data, valid = args.unwrap(ready)
3636
plus7 = data + LoopbackInOutAdd.add_amt.value
37-
data_chan, data_ready = loopback.type.wrap(plus7.as_uint(16), valid)
38-
data_chan_buffered = data_chan.buffer(ports.clk, ports.rst, 5)
37+
data_chan, data_ready = Channel(UInt(16), ChannelSignaling.ValidReady).wrap(
38+
plus7.as_uint(16), valid)
39+
data_chan_buffered = data_chan.buffer(ports.clk, ports.rst, 1,
40+
ChannelSignaling.FIFO)
3941
ready.assign(data_ready)
4042
loopback.assign(data_chan_buffered)
4143

lib/Dialect/ESI/runtime/cpp/lib/backends/Cosim.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,6 @@ class WriteCosimChannelPort : public WriteChannelPort {
182182
~WriteCosimChannelPort() = default;
183183

184184
void connectImpl(std::optional<unsigned> bufferSize) override {
185-
if (desc.type() != getType()->getID())
186-
throw std::runtime_error("Channel '" + name +
187-
"' has wrong type. Expected " +
188-
getType()->getID() + ", got " + desc.type());
189185
if (desc.dir() != ChannelDesc::Direction::ChannelDesc_Direction_TO_SERVER)
190186
throw std::runtime_error("Channel '" + name +
191187
"' is not a to server channel");
@@ -251,10 +247,6 @@ class ReadCosimChannelPort
251247

252248
void connectImpl(std::optional<unsigned> bufferSize) override {
253249
// Sanity checking.
254-
if (desc.type() != getType()->getID())
255-
throw std::runtime_error("Channel '" + name +
256-
"' has wrong type. Expected " +
257-
getType()->getID() + ", got " + desc.type());
258250
if (desc.dir() != ChannelDesc::Direction::ChannelDesc_Direction_TO_CLIENT)
259251
throw std::runtime_error("Channel '" + name +
260252
"' is not a to client channel");

0 commit comments

Comments
 (0)