Building registers and a register bank

Starting with a D flip-flop we will build an 8-bit register first and then a register bank for our ALU.

Description of the register bank:

  • It contains 4 registers and each of it can store 8 bits. Each registers has a 2-bit id (00, 01, 10, 11). For simplicity we sometimes call them just “register 0”, “register 1” which obviously correlates which the interpretation of the id as an unsigned integer.

  • It supports read and write operations:

    • (Reading) With the 2-bit inputs sel_out0 and sel_out1 you can select from which register you read the content from the 8-bit outputs out0 and out1 respectively.

    • (Writing) With the 2-bit input sel_in you can select which register gets overwritten with the 8-bit input in. Overwriting takes affect if the clock input is one.

    We will introduce in the next section a more compact notation to address a register.

  • Special register: Register reg0 is a zero register. It always contains a bit pattern with zeros only, i.e. writing to it simply gets ignored, reading from it gives always the zeros bit bit pattern.

Video tutorial

In the video I will start with a copy of the final project in session 2. This is a link to my project for session 2 and if you want you can fork it so that we start on the same page.