RIMS
First use
Debugging
Timer
UART
Assembly
Test vectors
First use
- Double-click RIMS desktop
icon
- Click "Save" button to save
the preloaded sample C program
- Click "Compile" button to
convert C code to machine instructions (not seen by user) for the RI
microcontroller
- Click "Run" button to run
the program
- Click "A0" switch to change
A0's value from 0 to 1, note the "B0" value changes to 1 and its LED
turns green
per the sample program, which sets B0 to 1 when
A0 is 1 and A1 is 0.
- Click the "A1" switch, note
that B0 changes back to 0, according
to the sample program.
Debugging
- While running, move speed
slider left to execute slower, right to execute faster.
- Press "Break" to stop
execution; arrow indicates current C instruction
- Press "Step" to execute one
machine instruction (note: one C instruction may consist of several
machine instructions).
- Press "Continue" to resume
execution
Timer
- Open a new editable RIMS
file by clicking the menu bar File --> New or File -->
Open
- Inside of the main function
of the code, use the function TimerSet(int) to set the length of the
timer interval. The argument is in milliseconds.
- Use the function TimerOn()
to enable the timer.
- Insert a new function above
the main function of the format:
void TimerISR() {
//ISR code
}
The TimerISR() function will be called
each time the timer interval elapses. UART
- Open a new editable RIMS
file by clicking the menu bar File --> New or File -->
Open
- Inside of the main function
of the code, use the function UARTOn() to enable the UART peripheral.
- Insert a new function above
the main function of the format:
void RxISR() {
//ISR code
}
- 'T' is the transmit data
register. Write a byte to 'T' to transmit it over the UART.
- 'R' is the receive data
register. Reading 'R' will return data received over the UART.
- 'TxReady' is a flag set when
the UART is ready to transmit. It is cleared automatically
when T is loaded with data.
- 'RxComplete' is set to 1
when a byte has been received from the UART. It is cleared
automatically when R is read.
Assembly
- The MIPS assembly code can be viewed by clicking the menu bar View --> View assembly.
- The editing mode can be switched to assembly by clicking the menu bar Tools --> Develop ASM.
- This allows you to code in the assembly language your C code is being compiled to.
- You can open and save assembly files and the compile button is replaced by an assemble button
- You can switch back to C in a similar fashion by clicking the menu bar Tools --> Develop C.
Test vectors
- Test vectors can be activated by clicking the "Use test vectors" button which can be found to the right of the UART input and
to the left of the symbol watch list.
- A code box will pop up that includes a sample test vector file. Loading and saving the test vector file created can be done using the buttons directly below
this box.
- Using the buttons and switches while running your code is disabled when test vectors is enabled. Clicking the run button will execute your code and at the same time go through your test vector line by line.
- There are 4 basic commands:
- "wait n scale", where n is a number and scale can be either s for seconds or ms for milliseconds. This allows you to pause the execution of your test vector for the amount of time you specify
- "assert n", where n is a number in binary, hex, or decimal. This will abort the execution of your code if B is not equal to n.
- "n", where n is a number in binary, hex, or decimal. This will adjust your buttons/switches such that A is equal to n.
- "generatetd", this is an optional command that can be placed at the end of your test vector file to automatically open RITS with the timing diagram created by executing your code using the test vector. WARNING: test vector execution will stop after reaching generatetd, write all commands before this.
- You can switch back to using manual input by clicking the "Use graphical inputs" button that replaced the "Use test vectors" button.
RITS
First Use
VCD file
First Use
- Double click the RITS.exe
icon on your desktop, or open RITS from RIMS by clicking the
'Generate/View Timing Diagram' button after running a simulation.
- Load a file if necessary by clicking File->Open on the menubar.
- The left side of the diagram
shows the names associated with each signal, while the bottom of the
diagram shows the amount of time expired.
- To zoom in or out, use the
magnifying glass buttons in the top right corner of the window.
To scroll once zoomed in, use the scrollbar at the bottom of
the window.
- You may save a JPG image of the diagram by clicking the 'Save JPEG' button on the top left of the window.
VCD File
- A Value Change Dump (VCD) file is a filetype used to log changes in signals over time.
- RIMS automatically generates these log files for you during simulation.
- More information on this filetype is available at http://en.wikipedia.org/wiki/Value_change_dump
RIBS
First use
Actions
Transitions
Simulation
First use
- Double click the RIBS.exe icon on your desktop.
- RIBS will load with a default state machine that implements a button toggle design.
- To add additional states,
click the 'Insert State' button. A new state will be placed
on the canvas. You may move this state by clicking and
dragging it to a new desired location.
- To add a transition, click
the 'Insert Transition' button. First select a source state
of the transition, followed by the destination. A new
transition will be drawn between the two states.
- To change state machine
properties such as the name or prefix, use the options available in the
state machine properties section at the top of the window.
Actions
- You may C code to any state
that will be executed during the visitation of that state. To
add actions to a state, first click the state to make it the active
object. This will enable the actions dialog box on the right
side of the window.
- You may enter any valid C
code into the actions dialog box. All code must be valid and
compilable C code, including semicolons at the end of statements.
- Global variables may be
declared in the Global Code dialog box at the top of the window.
Use globally defined variables in state actions to act as
counters or to implement other desired behaviours.
- Actions may also be added to
transitions as per a Mealy style state machine. To add
actions to a transition, first select the transition to enable the
Condition dialog box on the right side of the window. Add
valid C code - note the canvas will represent a Mealy style transition
as (condition / actions) on the canvas.
Transitions
- Transitions define the flow
of execution of the state machine. Transitions must have a
condition which is either true or false at any time.
- The default value of a new
transition is '1', or always true. To edit this value, click
the transition to enable the Condition dialog box on the right side of
the screen. The code inside of the Condition dialog box will
be inserted into a C-style if statement as follows: if ( condition_dialog_box_text ). Therefore the default condition of '1' will yield generated code results of 'if (1)', and the transition will always be true.
- To change the drawing style
of the transition, first right-click the transition. Select
either 'Convert to Line' or 'Convert to Bezier' to switch between a
straight line or a curve. To edit a bezier curve's flex
points, select the drawing handles of the curve and drag them around
the canvas to obtain a desired curve position.
Simulation
- RIBS can communicate with RIMS in order to graphically simulate your state machine design.
- Complete your state machine
design, and select 'Generate C' in order to create a C language
representation of your state machine.
- Save the state machine file if necessary, and your C file.
- Click the 'RIMS Simulation'
button to open a new instance of RIMS. If compilation errors
are detected you must fix them before continuing.
- If compilation was
successful, then RIMS will open and begin to simulate your C code.
Use the inputs on RIMS if necessary to facilitate the
execution of the design. Note that RIBS will highlight the
current state of the state machine as the execution flows.
- Closing RIMS will halt the simulation and allow you to edit your state machine again.