HDLBits Examsece241 2014 q5a

这篇文章介绍了如何使用Moore状态机设计一个处理任意长度输入的2's complement转换器,包括状态机的三个阶段划分、补码规则应用和关键代码实现。当输入全0时处理正数,输入出现1后进行负数转换,最终通过异步复位控制转换过程。

HDLBits Exams/ece241 2014 q5a

1.题目

​ 题目链接:https://hdlbits.01xz.net/wiki/Exams/ece241_2014_q5a

​ You are to design a one-input one-output serial 2’s complementer Moore state machine. The input (x) is a series of bits (one per clock cycle) beginning with the least-significant bit of the number, and the output (Z) is the 2’s complement of the input. The machine will accept input numbers of arbitrary length. The circuit requires an asynchronous reset. The conversion begins when Reset is released and stops when Reset is asserted.

​ 题目大意为用Moore状态机输出二进制数据的补码。

2.思路

​ 补码规则:正数为原码,负数为原码取反加一。

​ 本题中,当输入全为0时,认为是正数,z直接输出。当x出现第一位1时,认为输入二进制数据为负数,此时补码扔为输入本身,例如1_0000_0000补码仍为1_0000_0000。出现第一位1之后的输入位,根据补码规则,应取反,例如1001_0000_0000的补码为1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值