In computers, hardware and software complement each other. software can reduce hardware costs and speed up. This is the value of hardware accelerators. In our simulation environment, we can use software to simulate some hardware conditions that can be simulated, such as 38 decoder.
//////////////////////////////////////// //////////////////////////////////
# Include
Using namespace STD;
Int main ()
{
Char Yes = 'y ';
Do {
Int A = 0, B = 0, c = 0;
Printf ("input a, B, c \ n ");
While (1 ){
Scanf ("% d", & A, & B, & C );
If (A <= 1 & A> = 0) & (B <= 1 & B> = 0) & (c <= 1 & C> = 0) break;
Printf ("the input value is 0, 1 \ n ");
}
Printf ("input a = % d B = % d c = % d \ n", A, B, C );
Printf ("enable High Level 1 valid (already 1) \ n ");
Printf ("[38 decoder], output low level valid (already 0) \ n ");
Int y [8] = {0 };
Y [0] = A | B | C;
Y [1] = A | B | (1 ^ C );
Y [2] = A | (1 ^ B) | C;
Y [3] = A | (1 ^ B) | (1 ^ C );
Y [4] = (1 ^ A) | B | C;
Y [5] = (1 ^ A) | B | (1 ^ C );
Y [6] = (1 ^ A) | (1 ^ B) | C;
Y [7] = (1 ^ A) | (1 ^ B) | (1 ^ C );
For (INT I = 0; I <8; I ++)
{
If (Y [I] = 0 ){
Printf ("output end Y % d low level valid, value: % d \ n", I, I );
}
}
Printf ("Doyou want again? Y/Y \ n ");
Cin> yes;
} While (Yes = 'y') | (Yes = 'y '));
Return 0;
}