Logical consistency between hardware and software-program simulation of 38 Decoder

Source: Internet
Author: User

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;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.