Homework #2


  1. I'm deleting this problem since you should already know how to do this. Is this a good assumption? For each of the 18-bit 2's complement numbers
    • Determine the hex and decimal value.
    • Calculate, by hand and show your work, the 2's complement.
    Note that the comma's in the values below are only there to make reading the values more straightforward.
    1. 01,0111,1010,0110,1001
    2. 00,0101,1101,1001,0010
    3. 10,1011,0001,1000,0110
    4. 11,1010,1100,0011,1010
  2. In the following problem, you will build a box which processes keyboard scancodes. When you press a key on a keyboard, the keyboard sends an 8-bit code to the computer called a PS2 scancode. Each key has its own scancode listed below. The relationship between the keys and their scancode is not based on ASCII nor any other discernible pattern.
    Keyboard Key Scancode (in hex)
    0 0x45
    1 0x16
    2 0x1E
    3 0x26
    4 0x25
    5 0x2E
    6 0x36
    7 0x3D
    8 0x3E
    9 0x46
    Build a box which converts an 8-bit scancode for the digits 0-9 into a 4-bit hexadecimal values.
    Nomenclature: Scancode decoder
    Data Input: D = std_logic_vector(7 downto 0);
    Data Output: H = std_logic_vector(3 downto );
    Control: none
    Status: none
    Behavior: Converts the scancode d, representing a the key of a decimal digit, into its 4-bit value. For example, if D = 25_16, the scancode for the character "4", then the converter should output H = 0100_2. Assume that the inputs are always legal hexadecimal scancodes.
    Use the when statement syntax to describe the output in terms of the input. Provide a print out of your completed code along with a complete header. Provide a print out of your timing diagram - make the signal values legible.