Memory Based Programmable State Machine for Direct Hardware Control

Make it to the Right and Larger Audience

Blog/Press Release

Memory Based Programmable State Machine for Direct Hardware Control

Finite state machine is widely used in digital design. However its behavior such as state transition and output driving is hard coded which is not convenient or even acceptable in many scenarios. Here we briefly introduce a memory based programmable state machine. The behavior of the state machine is NOT hard coded and can be programmed on the fly by software.

Let’s take a look of a simple hard-coded FSM example at first. We have three state, ST0, ST1, and ST2. State transition condition is as shown: if in0 is high ST0 moves to ST1, and so on. At each state some output is asserted: out0 is 1 when state is ST0, out1 is 1 when state is ST1, and so on.

mme_prog_fsm_2

Verilog implementation of the state machine are as below.

 

 

As can be seen, state transition and output driving at each state is hard-coded. So what if later we want to drive both out1 and out2 to be high during ST1? Or instead of waiting for in0 to be high we want ST0 transit to ST1 after some fixed clock cycles?

In general, here are some scenarios we may want to use programmable state machine:

1. The state machine is used to control a third-party IP. But at the time of design, the sequence of how to control IP is not fully determined or not fully understood. Or it could be the first time to use an IP, some abnormality is expected and to be safe designer likes to have some programmability to change state machine behavior.

2. Processor is not available. Normally we can use SOC processor to do this kind of programmable control. A typical way is to connect input condition signals such as in1, in2, and in3 to a status register. Processor can poll/read this register to know input condition. Or input condition signals can be connected as one of processor interrupt sources. Based on the input condition (via either polling or irq), processor writes another control register which in turn drives out0, out1, and out2. All good. But processor may not be available in some use cases:
2.1 We want to save processor power. We can lower processor clock rate so processor is still up and running and is able to check status register and write control register. But we can not further gate off processor clock.
2.2 To further lower power, we may want to shut down processor power domain and even the power source. Programmable state machine can be in a small and always on domain to monitor inputs and control outputs.

3. Response latency issue. Even processor is available but if the response latency requirement is high, using processor is not a suitable solution. This is due to processor polling or IRQ latency. Instead if programmable state machine is hardware based its response latency can be better managed. For our memory based programmable state machine, it is pretty much determined by clock rate and memory speed.

4. Properly partitioned hardware and software are always needed. Software should be used for low date rate and irregular data and hardware should be used for high data rate and regular data which is also the scenario we want to use programmable state machine. Related in today’s ASIC design, we try to squeeze many functions into software and the benefit is clear – time to market, flexibility, and so on. But we have seen many cases subtle issue happens due to software control timing. Designers are spending much more time to debug software issue.

So we know we would like to have programmable state machine for certain scenarios in our design. Next if you google “programmable state machine”, you can see some articles pop up and the following two are good examples out of them:

http://www.research.ibm.com/people/g/gdittma/publications/HeaderParser_Dittmann.pdf
http://www.dc.uba.ar/materias/disfpga/2010/c2/descargas/TechXclusive%20Creating%20Embedded%20Microcontrollers.pdf

The design described in these two articles works as a simplified processor. It has a simplified instruction set and an ALU unit to do AND/OR/ADD/Shift/etc operation. The programmable state machine we are going to introduce is even simpler than this.

The following is author subscription content.
To gain access you can subscribe to this author's posts at Subscription of SD-RTL-DGN Posts. Subscription is valid for three months.
Highlights: 883 words, 1 images
 
Profile Photo
We are a small team of ASIC and FPGA design engineers with combined >40 years of experience. We successfully led several chips through the whole design to TO process. Familiar with Xilinx FPGA, we designed complicated system of using multiple FPGAs to verify complicated ASIC and also for the final products. We are interested in working as independent contractor for your projects. Feel free to contact us.
Groups:

1 Comment
  1. IanH 5 years ago
    0
    -0

    Thanks for sharing. Nice work.

    5

Contact Us

Thanks for helping us better serve the community. You can make a suggestion, report a bug, a misconduct, or any other issue. We'll get back to you using your private message ASAP.

Sending

©2021  ValPont.com

Forgot your details?