pc2 / pc2/sus-compiler

How BlueSpec's Guarded Atomic Actions could be translated to SUS

Open
#157 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Language Design
Dominant language
Rust
Stars
126
Forks
6
PR merge metrics
No merged PRs in 30d

Description

It's becoming a convention for SUS code to use try_ and may_ prefixes for "guarding" actions and triggers. For instance, look at the FIFO interface: output bool may_push and action push: T data_in. Likewise the other side of the FIFO might see input bool try_pop and trigger pop : T data_out

We could have language constructs for try_ and may_ variants of actions & triggers

Implicitly, when seeing something like

when x == 4 {
  action receive_data : int a, bool b {}
}

The compiler could insert a new output port output bool may_receive_data = x == 4.

Sadly, this doesn't translate too well to triggers. A naked trigger my_trigger takes no condition. Unless we add some kind of guard {} block?

Something like

FIFO fifo
guard { // Implicitly converts to "when fifo.may_pop & try_data_valid"
  float data = fifo.pop()
  
  trigger data_valid : data // Implicitly spawns an action try_data_valid
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the FIFO interface examples and the proposed try_, may_, and guard {} syntax in the issue. Determine how guarded actions and triggers should translate to SUS, including trigger conditions and implicit ports. Done means the language behavior and translation rules are specified clearly enough to implement and test.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.