Question

Inputs: A[128][8], go (bit), Outputs: sdiff (xx bits), done (bit) while(1){ while( !go ); done = 0; m = 127; n = 0; sdiff = 0

Can someone help convert this C code to HLSM (list local storage w bits and draw HLSM)? Any help would be greatly appreciated.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Approach

1.Identify the inputs and outputs.

2.Identify what you may need to store locally(Using registers)

3.Draw HLSM

HLSM stands for high level state machine.

HLSM can be used to capture more complex behaviour such as :

  • capture more complex logic involving multi-bit variables.
  • Local storage.
  • Arithmentic Operations -Add,Multiply etc..

● HSLMs will follow these conventions

  • – All inputs, outputs, and local storage are defined at the top of the HLSM diagram
  • – Registered values change on rising clock edges
  • – Transition bits are implicitly ANDed with rising clock edge
  • – Any output bit not explicitly assigned is 0
  • – Any registered value not explicitly assigned holds its value
  • – Bits are designated by surrounding them with single quotes, integers have no quotes
  • '1' is a bit value, 1 is an integer
  • “:=” assigns a value to a variable, “==” compares two values.
  • “//” defines a comment, just as in C or C++

                     HLSM Warnings.

● Clocked storage items are not updated in the same clock cycle that their control signals are set. Must wait for rising clock edge

● Note: The register control bits set up in a state prepare the value on the register inputs to be captured on the next clock cycle!

          Question:

input: A[128][8], go[bit]

output: sdiff (xx bits) , done(bit)

sdiff uses the diff command to compare them, and writes the results to standard output in a side-by-side format. The sdiff command displays each line of the two files with a series of spaces between them if the lines are identical. It displays a < (less than sign) in the field of spaces if the line only exists in the file specified by the File1 parameter, a > (greater than sign) if the line only exists in the file specified by the File2 parameter, and a | (vertical bar) for lines that are different.

HLSM diagram is as follows:


Add a comment
Know the answer?
Add Answer to:
Can someone help convert this C code to HLSM (list local storage w bits and draw...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 9. The following C-like code calculates the greatest common divisor (GCD) of the two 8-bit positi...

    9. The following C-like code calculates the greatest common divisor (GCD) of the two 8-bit positive integers a and b (Aside: This is Euclid's algorithm from 300 BC). Complete the HLSM for the code (Answers are case sensitive) Inputs: byte a, byte b, bit go Outputs: byte gcd, bit done GCD while (1) ( while (!go); done 0 while (a!-b){ if(a>b){ a-a b else gcd-a done 1 Inputs: go (bit), a, b (8 bits) Outputs: done (bit), ged (8 bits)...

  • microprocessors,,pls help.. 1. (3 Points) Draw a timing diagram similar to the 'practical' case of figure...

    microprocessors,,pls help.. 1. (3 Points) Draw a timing diagram similar to the 'practical' case of figure 5, below, for the case where signal Ao makes its transition first. Note: For each timing diagram that you draw, be sure that subsequent events appear to the right of causative events, and show causality arrows. 3.1 Glitch pulses Consider the one-bit adder circuit of figure 4. This circuit is called a one-bit (binary) adder because output signal So is the sum of input...

  • Can someone help me to convert from c++ to C program int main() { srand(time(0)); int...

    Can someone help me to convert from c++ to C program int main() { srand(time(0)); int playAgain; int PlayerScore=0; int computerScore= 0; int ties= 0; do { system("CLS"); Firstturn = rand()%(2-1+1)+1;// starting person. ComputerRandomPosition= rand()%(9-1+1)+1;// computer first pick- random gameWin=3; block1= '1'; block2= '2'; block3= '3'; block4= '4'; block5= '5'; block6= '6'; block7= '7'; block8= '8'; block9= '9'; //start of program cout<<"Welcome to Tic Tac Toe Game"<<endl<endl; cout<<"Player:"<<playerScore<<"Computer:"<<computerScore<<"Ties:"<<ties<<endl; if(Firstturn==1)// player first { cout<<"Please Select your a grid to place (X):"<<endl<<endl;...

  • C++ Can someone please help me with this problem- commenting each line of code so I...

    C++ Can someone please help me with this problem- commenting each line of code so I can understand how to solve this problem using the C++ programming language? I really need help understanding how to create a file for the program to read. Do I create the file in Visual basic or create a text file? I have the code, just need to know how to create the file for it to read. #include<fstream> #include<iostream> using namespace std; int main()...

  • I need help with this C code Can you explain line by line? Also can you...

    I need help with this C code Can you explain line by line? Also can you explain to me the flow of the code, like the flow of how the compiler reads it. I need to present this and I want to make sure I understand every single line of it. Thank you! /* * Converts measurements given in one unit to any other unit of the same * category that is listed in the database file, units.txt. * Handles...

  • please, Teacher, help me with this question step by step please and explain everything, my Teacher?...

    please, Teacher, help me with this question step by step please and explain everything, my Teacher? EENG 250 Lab 4 M&N Flip Flop Intorduction: There are four types of latches or flip flop designs that are commonly used in designs. However it is always possible to create a custom design. For example take the JK Flip Flop. It can be built using a D Flip Flop. This can be done using state diagram design processes. As shown in the example...

  • C++ program to convert between decimal, hexadecimal, and octal. Please Help!!

    Hi, I need help writing a program that reads in data (hex, octal or decimal values) from an input file and outputs the values in to another base form (hex, octal,decimal) one line at a time depending on the formatting characters provided by the input file. I am posting the code requirements below and an example of what theinput file will look like and what should be output by the program. I only need the one .cpp program file. Thanks...

  • # In this file, fill in the ... parts with lines of code. Do not # create new functions. from ran...

    # In this file, fill in the ... parts with lines of code. Do not # create new functions. from random import seed, randrange P=[" ♟♜♝♞♛♚"]; L,R,BL,TL=["▌▐▄▀"] BonR=WonR=WonB=DonR=DonB=RonB=GonR=GonB=RonG='\033[1;m\033[' WonR+='7;31;47m' # For drawing a white piece on a red background WonB+='7;30;47m' # For drawing a white piece on a black background DonR+='2;37;41m' # For drawing a dark piece on a red background DonB+='2;37;40m' # For drawing a dark piece on a black background GonR+='2;33;41m' # For drawing gold on a red...

  • I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I...

    I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I just have to explain a lot so you understand how the program should work. In C programming, write a simple program to take a text file as input and encrypt/decrypt it by reading the text bit by bit, and swap the bits if it is specified by the first line of the text file to do so (will explain below, and please let me...

  • C++ Help Task B: Translation While a nucleotide is the basic unit of information, three nucleotid...

    C++ Help Task B: Translation While a nucleotide is the basic unit of information, three nucleotides, or codon, is the basic unit of storage. The reason for this is that each gene codes for a protein, and all proteins are made from 20 amino acids. Recall that there are 4 different bases that make up dna. Thus, three bases can encode for 4x4x4 = 64 different symbols. Two base pairs can only encode for 4x4 = 16 symbols, which is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT