h1

Wait-Trigger & Branch Trigger Level Detection

5 February, 2010
Posted by John Williams

This post covers the addition of two requested features to the Python v1 Compiler and the underlying pcp32 firmware.

  • Branch-on-trigger Level Detection
    • Python API Call: branch(label, triggers, level = 1)
    • PCP32 Instruction: btr [triggers] [level] [address]
  • Branch Wait
    • Python API Call: branch_wait(label, triggers, level = 1)

Branch-on-trigger Level Detection

One feature that has been requested is the ability to select the level to trigger when using a branch event.

When this flag is set to zero, the trigger mask will select bits of the trigger inputs that must all be low in order for a trigger to occur. If all of the bits of the trigger mask are zero, the default behavior is to never trigger regardless of whether high or low level detection is used.

Branch Wait

The branch-on-trigger (btr) instruction was previously used mainly in loops to spin the processor while waiting for some trigger input.

It was discovered that this functionality could be duplicated by taking advantage of a property of the halt instruction that causes the last instruction in the pipeline to be executed every cycle.

The branch_wait event will be compiled down to the following sequence:

halt, nop, nop, nop, nop, nop, btr

filling all 6 branch delay slots and achieving the desired behavior.

Note: These features are not included in the recent 0.32 release but are in the repositories and will be included in all subsequent releases; additionally, the new level argument is optional for each and will default to the previously assumed value of  ’1′

Advertisement

One comment

  1. [...] release was support for the branch-on-trigger and branch-wait features discussed in John’s post. Additionally, some of the DHCP work done by Jeff was [...]



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.