类型转换构造函数和构造函数_代码转换器的构造

类型转换构造函数和构造函数

In this article, we are going to read about how these code converters are designed and are implemented inside the system?

在本文中,我们将阅读有关如何在系统内部设计和实现这些代码转换器的信息?

(i)二进制到格雷码转换器的设计 ((i) Designing of Binary to Gray Code converter)

4-bit binary to gray code converter converts a 4-bit binary number to 4-bit gray code. Binary numbers are provided as input in the form of B3 B2 B1 B0 (MSB is the leftmost and LSB is the rightmost) and we get output in the form of Gray code as G3 G2 G1 G0 (MSB is the leftmost and LSB is the rightmost). Thus, the code converter is equivalent to four different logic circuits. One for each of the truth table. The next step is to derive simplified Boolean expressions for each truth table using the K-Map and then we can get the relation between input and output.

4位二进制到格雷码转换器将4位二进制数转换为4位格雷码。 二进制数以B 3 B 2 B 1 B 0的形式提供(MSB在最左边,LSB在最右边),并且我们以格雷码的形式得到输出,例如G 3 G 2 G 1 G 0 (MSB是最左侧,而LSB是最右侧)。 因此,代码转换器等效于四个不同的逻辑电路。 每个真值表一个。 下一步是使用K-Map导出每个真值表的简化布尔表达式,然后我们可以得到输入和输出之间的关系。

Let's create a conversion table that stores the inputs and their corresponding output for all possible cases of the 4-bit binary number.

让我们创建一个转换表,其中存储4位二进制数的所有可能情况的输入及其对应的输出。

Input (Binary Code) Output (Gray Code)
B3 B2 B1 B0 G3 G2 G1 G0
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 1 0 0 0 1 1
0 0 1 1 0 0 1 0
0 1 0 0 0 1 1 0
0 1 0 1 0 1 1 1
0 1 1 0 0 1 0 1
0 1 1 1 0 1 0 0
1 0 0 0 1 1 0 0
1 0 0 1 1 1 0 1
1 0 1 0 1 1 1 1
1 0 1 1 1 1 1 0
1 1 0 0 1 0 1 0
1 1 0 1 1 0 1 1
1 1 1 0 1 0 0 1
1 1 1 1 1 0 0 0
输入(二进制代码) 输出(格雷码)
B 3 B 2 B 1 B 0 G 3 G 2 1号 G 0
0 0 0 0 0 0 0 0
0 0 0 1个 0 0 0 1个
0 0 1个 0 0 0 1个 1个
0 0 1个 1个 0 0 1个 0
0 1个 0 0 0 1个 1个 0
0 1个 0 1个 0 1个 1个 1个
0 1个 1个 0 0 1个 0 1个
0 1个 1个 1个 0 1个 0 0
1个 0 0 0 1个 1个 0 0
1个 0 0 1个 1个 1个 0 1个
1个 0 1个 0 1个 1个 1个 1个
1个 0 1个 1个 1个 1个 1个 0
1个 1个 0 0 1个 0 1个 0
1个 1个 0 1个 1个 0 1个 1个
1个 1个 1个 0 1个 0 0 1个
1个 1个 1个 1个 1个 0 0 0

From the truth table, we can observe that,

从真值表中,我们可以观察到,

  1. 44444444
  2. The values in G3 is actually the output of XOR operation between the B4 and B3. Thus, G3 = B3 B3.
  3. G 3中的值实际上是B 4B 3之间的XOR运算的输出。 因此,G 3 = B 3⊕ 3。
  4. The values in G2 is actually the output of XOR operation between the B3 and B2. Thus, G2 = B2 B2.
  5. G 2中的值实际上是B 3B 2之间的XOR运算的输出。 因此,G 2 = B 2⊕B 2。
  6. The values in G1 is actually the output of XOR operation between the B2 and B1. Thus, G1 = B1 B1.
  7. G 1中的值实际上是B 2B 1之间的XOR运算的输出。 因此,G 1 = B 1⊕ 1。

We can verify our observation by solving and obtaining Boolean expression from the K-Map for each of Gray code bits, we already know by convention 1s are the minterms for K-Maps, thus K-map can be solved as,

我们可以通过求解并从K-Map中为每个格雷码位获取布尔表达式来验证我们的观察结果,按照惯例,我们已经知道1是K-Map的最小项,因此K-map可以解为:

类型转换构造函数和构造函数_代码转换器的构造
类型转换构造函数和构造函数_代码转换器的构造
类型转换构造函数和构造函数_代码转换器的构造
类型转换构造函数和构造函数_代码转换器的构造

Thus, the logic circuit for 4-bit Binary to Gray code can be drawn as,

因此,可以将4位二进制至格雷码的逻辑电路绘制为:

类型转换构造函数和构造函数_代码转换器的构造

(ii)格雷码到二进制码转换器的设计 ((ii) Designing of Gray to Binary Code converter)

Gray code to Binary code converter can be designed in the same procedure as we have followed above. For all the possible cases of input (4-bit Gray code) G3 G2 G1 G0, we need to obtain simplified expressions for output (4-bit Binary code) B3 B2 B1 B0 by solving the K-Map. All possible inputs and outputs can be summarized in a truth table as,

格雷码到二进制码转换器的设计方法与上面所述相同。 对于输入(4位格雷码) G 3 G 2 G 1 G 0的所有可能情况,我们需要通过求解K获得输出(4位二进制码) B 3 B 2 B 1 B 0的简化表达式-地图。 所有可能的输入和输出都可以在真值表中总结为:

Gray Code (Input) Binary Code (Output)
G3 G2 G1 G0 B3 B2 B1 B0
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 1 0 0 0 1 1
0 0 1 1 0 0 1 0
0 1 0 0 0 1 1 1
0 1 0 1 0 1 1 0
0 1 1 0 0 1 0 0
0 1 1 1 0 1 0 1
1 0 0 0 1 1 1 1
1 0 0 1 1 1 1 0
1 0 1 0 1 1 0 0
1 0 1 1 1 1 0 1
1 1 0 0 1 0 0 0
1 1 0 1 1 0 0 1
1 1 1 0 1 0 1 1
1 1 1 1 1 0 1 0
格雷码(输入) 二进制代码(输出)
G 3 G 2 1号 G 0 B 3 B 2 B 1 B 0
0 0 0 0 0 0 0 0
0 0 0 1个 0 0 0 1个
0 0 1个 0 0 0 1个 1个
0 0 1个 1个 0 0 1个 0
0 1个 0 0 0 1个 1个 1个
0 1个 0 1个 0 1个 1个 0
0 1个 1个 0 0 1个 0 0
0 1个 1个 1个 0 1个 0 1个
1个 0 0 0 1个 1个 1个 1个
1个 0 0 1个 1个 1个 1个 0
1个 0 1个 0 1个 1个 0 0
1个 0 1个 1个 1个 1个 0 1个
1个 1个 0 0 1个 0 0 0
1个 1个 0 1个 1个 0 0 1个
1个 1个 1个 0 1个 0 1个 1个
1个 1个 1个 1个 1个 0 1个 0

Solving K-Map to get the required Boolean expressions,

求解K-Map以获取所需的布尔表达式,

类型转换构造函数和构造函数_代码转换器的构造
类型转换构造函数和构造函数_代码转换器的构造
类型转换构造函数和构造函数_代码转换器的构造
类型转换构造函数和构造函数_代码转换器的构造

Logic Diagram for Gray to Binary converter can be drawn as,

格雷到二进制转换器的逻辑图可以绘制为

类型转换构造函数和构造函数_代码转换器的构造

翻译自: https://www.includehelp.com/basics/construction-of-code-converters.aspx

类型转换构造函数和构造函数