Digital_Lab_01A

"Arithmetic operations of two input signals"

by

Choon B. Kim, Ph.D., a retired ASIC engineer

cbkweb123@gmail.com

1. Design Specifications:

Add the following features to the previous Digital_Lab_01.

1.1) Your design performs arithmetic operations of two inputs which are entered as follows.

- The first input is entered at SW[3:0] and is stored in the memory by pressing down the Push-button Switch KEY[3].

- After the first input is stored at the memory, the second input is entered at SW[3:0] and displayed on the HEX3-HEX0(7-segment Display).

 1.2) The memory value can be checked anytime by setting SW[9:4]=100000(i.e., Pushing up only SW[9] switch).

 1.3) When both inputs are ready, do the following arithmetic operations using SW[9:4] as an operation selector.

         The result(mod-16 number) is displayed on HEX3-HEX0.

a) [ADD]     When SW[9:4]=010000,     the second input(SW[3:0])     +    memory value

b) [SUB]     When SW[9:4]=001000,     the second input(SW[3:0])     -     memory value

c) [MUL]     When SW[9:4]=000100,     the second input(SW[3:0])     *     memory value

d) [DIV]      When SW[9:4]=000010,     the second input(SW[3:0])     /     memory value

e) [MOD]    When SW[9:4]=000001,     the second input(SW[3:0])    %    memory value

 

2. Testing (video on YouTube):

Test case: 
      The first input value       = 3 (at memory)
      The second input value = 5 (i.e., SW[3:0] ="0101")

https://youtube.com/shorts/lVs2pQjRa_k

 

3. Recommended additional work:

Add a checking & displaying an error case of division when the divisor equals 0.

Test case: 
      The first input value       = 0 (at memory)
      The second input value = 5 (i.e., SW[3:0] ="0101")

https://youtube.com/shorts/TchcEn99YbY

 

4. Key lesson(s) learned from this Lab:

4.1)  How to handle the multiple operations by different selection conditions

4.2)  How to use an internal buffer(register) to hold a value

4.3)  Arithmetic operations with error case checking

 

5. Timing(optional):

Assuming your design is used as a part of a bigger clock-based system, find the maximum clock frequency of your design.

Explain how you get it.

 

-------------------------------------------  The End of Digital_Lab_01A ---------------------------------------------------