符号大小和二进制补码

Sign-magnitude and two's compliment

我正在做作业,遇到困难有人可以帮忙吗?

A new computer has been acquired by management of CIPOL a research lab sited around Teshie to help in the analysis of samples of blood taken from suspected cases of COVID-19. Upon testing the computer, it was realized by technicians that it can only process data fed into it in the form of sign magnitude. However, all the equipment in CIPOL work in the 2’complement environment. There is currently no interface to link the old systems and new computer. As the technical team leader, you have been summoned to brief management on the problem on hand. You are to:

Critically explain the challenge faced by your team in connection with the new and old computers and propose a solution to it.

这是我对这个问题的回答我不确定我是否正确:

Sign-magnitude is a way the computer stores negative numbers. There are two other ways which is 1’s compliment and 2’s complement. The new computer that represents data in sign-magnitute will work perfectly the old systems.

新电脑将不能与旧系统无缝工作。

1。带符号和大小的二进制表示

符号大小使用第一位来表示数字的符号。因此,例如:

  • 000 为 0。
  • 001 是 1,第一个 0+ 符号。
  • 101 是 -1,第一个 1- 符号。

2。二补码二进制表示

此表示翻转数字的位并加一以表示负数:

  • 000还是0。
  • 001也还是1.
  • 111 为 -1。基本上翻转 001 的每一位并加 1。

3。解决方案

我想你会想要将从有符号表示转换为二补表示,因为实验室中的其他所有东西都已经使用有符号表示。

  • 正数
    • 无需更改。
  • 负数
    • 即,如果第一位是 1
      1. 将第一位替换为0
      2. 翻转所有位(这是一个简单的 NOT 逻辑运算符)。
      3. 新号码加 1。
    • 4 位带符号表示中 1011 或 -3 的示例:
      1. 将第一位替换为00011
      2. 翻转所有位 → 1100
      3. 新号码加1→1101

4。延伸阅读

有很多关于此主题的教程、视频和文章。如果您想了解更多: