Problem 5 (20 points) Recall that the BCD number format use 4 bits to encode dig
ID: 3590711 • Letter: P
Question
Problem 5 (20 points) Recall that the BCD number format use 4 bits to encode digits 0 to 9. We want to design a 2-digit BCD decrementer. Let al and a0 be two input BCD digits, and y1 and yo be two-digit BCD decrementing result. For example, if the inputs are 24 (i.e., a1-0010, a0-0100), the decrementor outputs will be 23 (i.e., y1-0010, yo-0011). If the inputs are 20 (i.e., a1-0010, a0-0000) the decrementor outputs will be 19 (i.e, y1-0001, yo-1001). The 00 and invalid inputs can be ignored. The input and output signals are . al, a0: 4-bit input in BCD format . yl, y0: 4-bit output in BCD format The entity declaration is 1ibrary leee: use ieee.std logic 1164.a11: use ieee.numeric std.all: entity bed_dec is portt al, a0: in std logic_vector (3 downto 0): yl, yo: out std logic_vector (3 downto 0) end bed_dec: Derive the architecture body.Explanation / Answer
y1 = DIGITS-1;
a0 = VMAX;
while (y1 > 0)
{
bcd[y1] = 0;
while (a1 >= a0)
{
a1 = a1 - a0;
bcd[i] = bcd[i] + 1;
}
a0 = a0 / 10;
y1 = y0 - 1;
}
bcd[0] = a1;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.