Question

In: Computer Science

How to compute the Z, N, C, and Z the condition code bit values? Given A...

How to compute the Z, N, C, and Z the condition code bit values? Given A and B, and after subtracting how do I find the condition codes? Please provide a few examples with the explanation.

Solutions

Expert Solution

The conditional codes Z, N, C stands for zero, negative and carry respectively. The value of conditional codes depends on the result of the previous evaluated expression.

Zero bit:- The value of this bit will be set to 1 if the result of the previous evaluated expression is zero. Otherwise, the value will be set as 0.

Negative bit:- The value of this bit will be set to 1 if the result of the previous evaluated expression is a negative value. The MSB of the result will be 1, if the value is negative. So, negative bit will be set to 1. Otherwise, it will be 0.

Carry bit:- The value of this bit will be set to 1 if the result of the previous evaluated expression generates a carry (addition) or a borrow (subtraction). Otherwise, the value will be set as 0. The value of C bit will also be set to 1, if the number of bits of the result exceeds the number of bits of the operation. (Example: performing n bit operations but resultant bits consists of more than n bits which is not representable)

Example:

Let A and B are equal values. Subtracting two equal values will give zero. Thus, A - B will set the value of zero bit as 1. Since, all the bits of the result are zero, the MSB will also be a zero bit. So, the number is not negative. Thus, N bit is 0. No borrow is generated, so C bit is also 0.

Suppose A is greater than B. Subtracting B from A will result in a positive value. So, Z and N will be set to 0. Since, no borrow is generated, C is also set to 0.

Consider A is less than B. Subtracting B from A will result in a negative value. So, the value of Z is 0 and N is 1. Here, a borrow will be generated, so the value of C will be set to 1.

Hope this helps. Doubts, if any, can be asked in the comment section.


Related Solutions

Find the margin of error for the given values of c, σ, and n. c =...
Find the margin of error for the given values of c, σ, and n. c = 0.98, σ = 0.78, n = 150
(a) Find the margin of error for the given values of​ c, σ​, and n. c...
(a) Find the margin of error for the given values of​ c, σ​, and n. c = 0.90​, σ = 3.8​, n = 100 E= _ (Round to three decimal places as​ needed.) (b) Construct the confidence interval for the population mean μ. c = 0.90 ​, x=9.1​, σ = 0.3 ​, and n = 47 A 90​% confidence interval for μ is _, _ (Round to two decimal places as​ needed.) (c)  Construct the confidence interval for the population mean...
a ) Find the margin of error for the given values of​ c, s, and n....
a ) Find the margin of error for the given values of​ c, s, and n. c = 0.80​, s = 6​, n = 15; b ) Find the margin of error for the given values of​ c, s, and n. c = 0.98 s =2.1​, n =10; c) Construct the indicated confidence interval for the population mean muμusing the​ t-distribution. Assume the population is normally distributed.c =0.90 x =14.9 s =3.0 n =10 The 90% confidence interval using a​...
Find the margin of error for the given values of​ c, s, and n. c=0.9595​, s=44​,...
Find the margin of error for the given values of​ c, s, and n. c=0.9595​, s=44​, n=2828 The margin of error is ____. ​(Round to one decimal place as​ needed.) pt. 2 Use the given confidence interval to find the margin of error and the sample mean. ​(14.7, 21.7​) The sample mean is ____. (Type an integer or a​ decimal.) pt. 3 In a random sample of 25 ​people, the mean commute time to work was 30.6 minutes and the...
Assume a binomial probability distribution with n=40n=40 and π=0.30π=0.30. Compute the following: (Round all z values...
Assume a binomial probability distribution with n=40n=40 and π=0.30π=0.30. Compute the following: (Round all z values to 2 decimal places.) a. The mean and standard deviation of the random variable. (Round your "σ" to 4 decimal places and mean to 1 decimal place.)   μ      σ    b. The probability that X is 16 or more. (Use the rounded values found above. Round your answer to 4 decimal places.)   Probability    c. The probability that X is 8 or less....
Write a VHDL code for a 4-bit comparator which takes two 4-bit input values and (0.5)...
Write a VHDL code for a 4-bit comparator which takes two 4-bit input values and (0.5) determines whether the numbers are equal. 2. 2. Write a structural VHDL code to implement the circuit of Fig. 2, using the components (0.5) developed in 1.3 and 2.1. 2. 3. Write a VHDL test bench for the above and verify by simulation. (0.5) 2. 4. Implement the design in an FPGA (Note: You may need a `clock manager' to reduce (1.0) the clock...
C++: how to do a bit rotation Left rotation of n = 11100101 by 3 makes...
C++: how to do a bit rotation Left rotation of n = 11100101 by 3 makes n = 00101111 (Left shifted by 3 and first 3 bits are put back in last). Right rotation of n = 11100101 by 3 makes n = 10111100 (Right shifted by 3 and last 3 bits are put back in first. int left(int n, unsigned int d) { } int right(int n, unsigned int d) { }
Given two sorted lists, L1 and L2, write an efficient C++ code to compute L1 ∩...
Given two sorted lists, L1 and L2, write an efficient C++ code to compute L1 ∩ L2 using only the basic STL list operations. What is the running time of your algorithm?
Find the minimum sample size n needed to estimate μ for the given values of​ c,...
Find the minimum sample size n needed to estimate μ for the given values of​ c, σ​, and E. c=0.95, σ=7.2, and E=1 Assume that a preliminary sample has at least 30 members. n=___ (Round up to the nearest whole​ number.)
Given the root C++ code: void sort() {    const int N = 10;    int...
Given the root C++ code: void sort() {    const int N = 10;    int x[N];    for(int i = 0; i < N; i++)    {        x[i] = 1 + gRandom-> Rndm() * 10;        cout<<x[i]<<" "; }    cout<<endl;    int t;       for(int i = 0; i < N; i++)    {    for(int j = i+1; j < N; j++)    {        if(x[j] < x[i])        {   ...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT