I have a four bit binary calculator I'm testing. What are the 4 best test cases to…
- User
I have a four bit binary calculator I'm testing. What are the 4 best test cases to demonstrate it's functioning. The calculator has inputs, A0, A1, A2, A3, B0, B1, B2, B3, C_in, and outputs S0, S1, S2, S3, C_out
- Assistant
To comprehensively test a 4-bit binary calculator (or adder), which adds two 4-bit numbers ( A ) and ( B ), and takes in a carry input (( C_{in} )), you'll want to consider various cases that cover edge conditions, normal additions, carries, and extreme values. Here are four test cases to demonstrate its functionality:
Test Case 1: Simple Addition without Carry
- Inputs:
- ( A = 0001 ) (1 in decimal)
- ( B = 0010 ) (2 in decimal)
- ( C_{in} = 0 )
- Expected Output:
- ( S = 0011 ) (3 in decimal)
- ( C_{out} = 0 )
Test Case 2: Addition with Carry
- Inputs:
- ( A = 0111 ) (7 in decimal)
- ( B = 0001 ) (1 in decimal)
- Inputs: