当前位置:网站首页>Verilog -- state machine coding method
Verilog -- state machine coding method
2022-07-05 08:00:00 【Drink more hot water-】
Contained in the state machine N States usually need to be represented by some coding , Status code , Or status assignment .
Choose the appropriate coding scheme , It will contribute to the utilization of circuit area and resources .
The three most common types of state coding are : Sequential binary encoding 、 Gray code and Hot code alone 、 Johnson code
Sequence code (Sequential State Machine Encoding)
Binary coding is the most compact coding , Each state encoded with sequential binary numbers .
eg. state0 state1 state2 state3 Expressed as '00' '01' '10' '11'
The advantage is that it uses the smallest number of bits of the state vector . But when it changes from one state to another , Many bits may change ,[ There are intermediate states ] Many transients , Easy to produce burr , Cause a logical error
Gray code (Gray Code )
In the transition of adjacent states , Only one bit at a time changes , It can reduce the possibility of burrs and some transients , But it is not suitable for situations with many state jumps .
Recursively generate code table
This method is based on the fact that gray code is reflection code , Use the following rules of recursion to construct :
1 Bit gray code has two codewords
(n+1) The first bit of gray code 2n Codeword equals n Codeword of bit gray code , Write in order , Prefixed 0
(n+1) After... In gray code 2n Codeword equals n Codeword of bit gray code , Write in reverse order , Prefixed 1 [4]
n+1 A collection of bit gray codes = n Bit gray code set ( The order ) Prefixed 0 + n Bit gray code set ( The reverse ) Prefixed 1
2 Bit code | 3 Bit code | 4 Bit code | 4 Bit natural binary code |
---|---|---|---|
00 | 000 | 0000 | 0000 |
01 | 001 | 0001 | 0001 |
11 | 011 | 0011 | 0010 |
10 | 010 | 0010 | 0011 |
110 | 0110 | 0100 | |
111 | 0111 | 0101 | |
101 | 0101 | 0110 | |
100 | 0100 | 0111 | |
1100 | 1000 | ||
1101 | 1001 | ||
1111 | 1010 | ||
1110 | 1011 | ||
1010 | 1100 | ||
1011 | 1101 | ||
1001 | 1110 | ||
1000 | 1111 |
Hot coding alone
namely One-Hot code , Also known as a bit effective code , Only one bit of each symbol value is '1', The others are '0',
Such as S0=3'b001,S1=3'b010,S2=3'b100
namely N A state needs N Trigger . The speed of the hot code state machine is only related to the number of transitions to a particular state, but not to the number of States , fast . And because its state decoding is simple , Therefore, the combinational logic circuit is saved and simplified .FPGA Due to the large number of registers, the logic gate resources of devices are tight , Using heat only coding can effectively improve FPGA Resource utilization and circuit speed . Single hot code also has simple design 、 Flexible modification and easy debugging 、 Easy to integrate 、 Easy to find critical path 、 Easy to carry out static timing analysis and other advantages . Therefore, try to use unique coding .
NEXT PAGE:
Specify the encoding method in the synthesizer
边栏推荐
- Altium designer 19.1.18 - Import frame
- Ten thousand words detailed eight sorting must read (code + dynamic diagram demonstration)
- Global and Chinese markets for recycled boilers 2022-2028: Research Report on technology, participants, trends, market size and share
- LED display equipment records of the opening ceremony of the Beijing Winter Olympics
- C language uses arrays to realize the intersection, union, difference and complement of sets
- The research found that the cross-border e-commerce customer service system has these five functions!
- 如何将EasyCVR平台RTSP接入的设备数据迁移到EasyNVR中?
- Drive LED -- GPIO control
- IC software learning
- Shape template matching based on Halcon learning [vi] find_ mirror_ dies. Hdev routine
猜你喜欢
Correlation based template matching based on Halcon learning [II] find_ ncc_ model_ defocused_ precision. hdev
Reasons for rapid wear of conductive slip rings
C WinForm [change the position of the form after running] - Practical Exercise 4
Markdown tips
Embedded composition and route
研究发现,跨境电商客服系统都有这五点功能!
Relationship between line voltage and phase voltage, line current and phase current
How to migrate the device data accessed by the RTSP of the easycvr platform to easynvr?
C language enhancement -- pointer
Create inf module in AMI code
随机推荐
C WinForm [realize the previous and next selection pictures] - practice 7
1089 insert or merge, including test point 5
How to excavate and research ideas from the paper
Train your dataset with yolov4
Altium Designer 19.1.18 - 清除测量距离产生的信息
Cadence learning records
Cadence simulation encountered "input.scs": can not open input file change path problem
Extern keyword function
Function and usage of function pointer
The printer encountered an abnormal configuration problem 0x8007007e (win10)
Introduction of air gap, etc
软件设计师:03-数据库系统
研究发现,跨境电商客服系统都有这五点功能!
VESC Benjamin test motor parameters
Global and Chinese market of peeled bourdon tubes 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets of large aperture scintillators 2022-2028: Research Report on technology, participants, trends, market size and share
如何将EasyCVR平台RTSP接入的设备数据迁移到EasyNVR中?
C WinForm [exit application] - practice 3
Network communication model -- Network OSI tcp/ip layering
Random function usage notes