h1

Input Counting Instruction added to the Python Compiler v1

2 February, 2010
Posted by David Nufer

Overview

The Input Counting instruction (icnt) has now been added into the Python Compiler v1 and is available on the SVN.  The icnt instruction has 5 subopcodes that define different functions:

  • Reset — resets one of the input counters.
  • Latch — latches the current value of one of the input counters to its associated register.
  • Write — writes the value of one of the input counter registers to the memory address in the address accumulator, and increments the address accumulator.
  • Compare — compares an input counter register to its associated compare register and sets the compare flag it the comparison is true.
  • Branch — branches if the compare flag is set.

New API Calls

There are five new API calls for the icnt instruction, one for each function:

  • reset_input_counter(input_channel) — input_channel :  input trigger
  • latch_input_counter(input_channel) — input_channel :  input trigger
  • write_input_counter(input_channel) — input_channel :  input trigger
  • compare_input_counter(input_channel) — input_channel :  input trigger
  • branch_input(label) — label : the instruction to jump to

There are 8 input triggers are defined in /software/python/sequencer/constants.py, one for each input channel.

Test Script

There is a small test script called test_input_counter.py that uses all the new API calls.  At first glance, it appears that all the new API calls compile properly.  The test script is also being used to test that the firmware implementation of the icnt instruction is working properly.

Advertisement

One comment

  1. [...] includes a working implementation of the icnt instruction, which can be read about in David’s post. The basics of the implementation were already in place, but a few tweaks were necessary to get the [...]



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.