Question: Description The assignment is designed to test your knowledge about Behavioral - Level Design ( Program to Circuit ) including High - Level State Machines

Description
The assignment is designed to test your knowledge about Behavioral-Level Design (Program to Circuit) including High-Level State Machines (HLSMs) and the use of Hardware Descriptive Language (HDL).
Questions
Q1. Produce the High-Level State Machines (HLSM) that represent the following C code.
Code:
while (1){
while (!go){
};
done =0;
while (m != n){
if (m > n){
m=m-n;
}
else {
n =n m;
}
}
gcd = a;
done =1;
if (m n){
m = m + n;
}
else {
n = n + m;
}
}
Q2. Convert the HLSM in (Q1) to a Truth-table and then, a circuit.
Q3. Convert the given C code in (Q1) to a Hardware Description Language (HDL).
Hint: If you translated the C program very well, you should have 12 states in total.
With 12 states, you would need to encode each state with 4bits.
Datapath component 1:, you would need a comparator for (m==n, mn), so all the three outputs from the comparator should go to the controller as inputs. This increases the number of inputs for your truth table to 8bits (4bits for state encoding, 1bit for go input, and 3bits from comparator).
Datapath components 2: you need two subtractors (one for n = n-m and one for m=m-n) and two adders (one for n=n+m, one for m=m+n), a multiplexer and a load register for done, n and m outputs each, and just a register for gcd output. The inputs to the multiplexers and registers would come from the combinational circuit part of the controller.
Therefore, 4bits for the state encoding +1bit for the input go+3bits for the comparator, making a total of 2^8bits is needed to construct your truth-table.
I know this cannot be done with hand. I suggest you leave out the truth-table part and just come up with a circuit diagram showing the Datapath component and the input/output of the state registers. You can just represent the combinational circuit part with a block symbol. Description
The assignment is designed to test your knowledge about Behavioral-Level Design (Program to Circuit) including High-Level State Machines (HLSMs) and the use of Hardware Descriptive Language (HDL).
Questions
Q1. Produce the High-Level State Machines (HLSM) that represent the following C code.
Q2. Convert the HLSM in (Q1) to a Truth-table and then, a circuit.
Q3. Convert the given C code in (Q1) to a Hardware Description Language (HDL).
Description The assignment is designed to test

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!