The Hotstate machine is a highly parameterized, microcode, algorithmic state machine. The Hotstate machine is programmed using a subset of C called CommaC. The compiler extracts the parameters for the state machine directly from the code and generates the microcode to implement the program.
The Hotstate machine supports all the control statements in C. The Hotstate machine also supports limited function calls and an interrupt vector.
Your code drives the architecture and the size of the Hotstate machine. Smaller programs generate physically smaller state machines that are faster and use fewer resources.
To implement concurrency, use multiple state machines. Each Hotstate machine has its structure driven by its program. Instead of one big state machine, several smaller state machines will be faster and take less resources.
/* Steve Casselman */
bool LED0 = 0; /* state0 */
bool LED1 = 0; /* state1 */
bool LED2 = 1; /* state2 */
/* inputs */
/* main loop */
if(a0 == 0 && a1 == 1)
LED0 = 1, LED0 = 0; //LED0 will equal 0
else if((a1 == 0 || a2 == 1 ) & !a0)
LED1 = 1;
if(a0 == 1 && a2 == 0)
LED2 = 1;
if(a0 == 0 && a2 == 0 & !a2)
LED0 = 0, LED1 = 0, LED2 = 0;
if (!a0) LED0 = 1;
} /* end while */
The hotstate compiler will create many files. When running the hotstate program, it will check to see if you have a makefile. If you don’t, hotstate will create one. You generate a testbench by using one of the options to generate different styles of testbenches, “make tbs” is the most efficient.
The hotstate compiler will generate a Verilog template file. In this file, you have the parameters that allow the hotstate machine to exactly match your program.
hotstate #(.NUM_STATES (3),.NUM_VARS (9),.NUM_VARSEL (4),.NUM_TIMERS (0),…
The waveforms below are taken from the parser example. Match the first while loop to the output of the analyzer.
Here’s a shout-out to RTLvision for the use of their excellent schematic generation tools!
Try it for Free
Try for free
Try the free version of the Hotstate machine and compiler
You don’t have to sign up to download the free software