Homework #2

Guidelines

  1. 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 underscores in the values below are only there to make reading the values more straightforward. Keep in mind if the MSB is 1 it is a negative value even though it is not a complete nibble.
    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 0);
    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 = 2516, the scancode for the character "4", then the converter should output H = 01002. 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 copy of your completed code (VHDL and Testbench) along with a complete header. Provide a copy of your timing diagram/waveform - make the signal values legible. Make sure to commit your VHDL code, Testbench and Waveform configuration file to BitBucket.