Skip to content

Add peek channel operation#3954

Draft
magancarz wants to merge 21 commits intogoogle:mainfrom
antmicro:93015-peek
Draft

Add peek channel operation#3954
magancarz wants to merge 21 commits intogoogle:mainfrom
antmicro:93015-peek

Conversation

@magancarz
Copy link
Contributor

This pull request adds a peek channel operation which allows viewing the first to-be-received channel value without removing it from the channel queue. This operation is also available in conditional and blocking/non-blocking variants and can be tested by running a bytecode or IR interpreter.

Simple example in DSLX:

let (tok, packet) = peek(join(), req_r);
let handle_packet = packet.id > u32:4;
let (tok, packet) = recv_if(tok, req_r, handle_packet, zero!<Packet>());

More complex usages such as packet filler with blocking peek and content based arbiter with non-blocking peek can be found in blocking_peek.x and content_based_arbiter.x respectively in the xls/examples directory.

Example IR with peek can be found in IR conversion golden file or generated by building peek_ir target in the examples directory.

  • Add support for Verilog generation
  • See how recv and peek operations implementation can be joined to avoid duplicating code
  • Add C++ tests for peek operation support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants