53 produce = esi.ChannelService.from_host(AppID(
"produce"), UInt(32))
54 count, count_valid = produce.unwrap(Bits(1)(1))
55 target = count.reg(ports.clk, ports.rst, ce=count_valid, name=
"target")
58 sent = Counter(32)(clk=ports.clk,
62 valid = sent.out < target
63 stream, stream_ready = Channel(UInt(32)).
wrap(sent.out, valid)
64 xact.assign(valid & stream_ready)
65 esi.ChannelService.to_host(AppID(
"stream"), stream)
67 query = esi.ChannelService.from_host(AppID(
"query"), UInt(8))
68 query_ready = Wire(Bits(1))
69 _, query_valid = query.unwrap(query_ready)
70 resp, resp_ready = Channel(UInt(32)).
wrap(sent.out, query_valid)
71 query_ready.assign(resp_ready)
72 esi.ChannelService.to_host(AppID(
"sent"), resp)