Use FSMD to interpret high level c++ code (用带有数据通道的有限状态机来编写c++方程)

本文介绍了如何运用带有数据通道的有限状态机(FSMD)来控制不同阶段的数据,以实现C++代码计算平方根的功能。FSMD由FSM(状态机)和Datapath(数据通路)两部分组成,比单纯的FSM更灵活。在FSMD中,FSM用于切换状态并指示Datapath何时以及如何进行不同的计算,而Datapath则负责执行这些计算。通过FSM和Datapath的交互,实现了输入数据到输出平方根的转换过程。

Finite state machine with data path:
Image result for fsmd

FSMD has two parts, FSM and Datapath. It's a more flexible mechanism to control data in different stage than FSM. In a standard FSMA, FSM is used to change the state, tell the datapath when and how to do different calculations,  and datapath is used to do different calculations.

Use FSMD to implement the function of c++ code which calculates the square root of a number(计算平方根):

while(sqaure<=data){  // control
square=sqaure+delta;  //calculate
delta=delta+2;
}
return delta/2 - 1  

Input of FSM:                 (square<=data), rst, clk

Output of FSM:               calculate, clean, returnnum(contr

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值