Forum Discussion
Altera_Forum
Honored Contributor
10 years ago --- Quote Start --- rromano001 thanks for detailed information. I have read that book freerange VHDL indeed is my desk book rightnow. The website you showed looks really nice and organized, I'll keep an eye on it. My only board available is DE1, but I think simulator would be more than enough for what I need, since i won't make use of the softcore and the other IP included in the development board. --- Quote End --- IN first good job, and thank for a correct measure of your level, ok for assembly programming but as I said before and about what you find on avery course remember something is in common to both VHDL (logic gates and register design) and programming language too. Don't assume VHDL as a programming language, it is also a programming language on its definition but you are using HDL part and are two really different thing of same language. When you use as programming ok you are using a computer, when HDL you are generating an image to some silicon. NEVER FORGET THIS!!! How much time you have to do job and just curious where is your location? Ok now you need some hint on how to manage fractional integer, start on our decimal system 129.35 is a fractional number, if you multiply by 1000 or large power of base your number get integer and fractional part is at left of weight of multiplier, so 129 where integer part and 35 fractional get transformed in 129350 where 350 is the fractional part. If this was previously clean don't worry and tell us. All numeric base as I suppose you learnt all number are can be represented as a series of base raised to weight multiplied by digit value, so 129.85 base 10 can be expressed as 10^2 * 1 + 10^1 * 2 + 10^0 * 9 + 10^-1 * 3 + 10^-2 * 5 if you multiply a number by the base you shift all number to left and enter a zero from right, if you divide number by base you shift number to right passing last digit to fractional or just dropping if integer numbers . On previous century a man invented the complement to base to do subtraction from addition, this was in the mechanical calculator era, this man idea of number property prepared our base 2 notation: one digit is devoted to sign and negative number where represented in this convenient manner due don't need know if they are positive or negative and just one operation was necessary, if you choose leftmost as sign operation can be performed on integer number regardless of sign. This way division and multiplication of complement number require an extra care to preserve sign information. What change of what we know if we change base? Just nothing that series it represent and values, if you need to represent decimal number in binary form you just need enough figure to fit number, just base value change from 10^weight to 2^weight so you just need more digit (BIT -> binary digit) right? Now if you decide have simple number we can do an example with 8 bit value, on integer unsigned you get value from 0 to 255 in signed from -128 to +127 and what if you reserve some bit to fractional? Just right part nibble is fractional largest number can represent are: Unsigned : +15 and 15/16 signed; -8 to +7and 15/16 to -8, smallest number can be +- 1/16 -> 0.0625 0111 1101 for example has: integer part 111 -> 7, fractional is 1 * 2^-1 + 1 * 2^-2 + 0 * 2^-3 + 1 * 2^-4 => .5 + .25 + .0625 or in fractional 1/2 + 1/4 + 0/8 + 1/16 or 13/16 resolution of numbers are .0625 In general resolution of fractional is base ^ - n whre n is te number of fractional digit. In case need finest resolution you just need add more bit to fractional to increase denominator of fraction and more bit to integer part to manage the largest number. Ok now how these number are to be treated? Simple they are just integer so ordinary addition subtraction can do the job. When you need output value you have to scale it. If you need help and started grasping something in VHDL IMHO stay away from Verilog, it is dangerous, it seems C but IT ISN'T at all. Try with a simple thing, get inspiration from Pyroedu LED and write your first exercise, - try drive board led in front of switches with a code, it can be very trivial but this familiarize you with assignment operator <=, then you can read switch as bus of 4 bit - drive some segment of Display from switches - learn how to write a module (equivalent to function and procedures of programming languages) - Write a module to display input values to hexadecimal figures on display - assemble this module in a project to display binary number from switches in both binary on LED and HEX on display, extend display module to more than one digit. I think this point you have more confidence with tool and a test bench for input from switches and display to hexadecimal number. If you prepare a simple combinational adder module then you can insert between switch input and display module and have two number from switches added together. If you do these simple step I am quite sure you understand more on your job. Till here you have used just combinatorial level, so grasp in full and experiment on board, possibly use SOF file, it is faster and don't wear programming flash, just it disappear on power cycle and board return to previous state. I am not your professor but I am still troubled with mine pupils try do thing from unknown, take your foot on stand and follow the right way. When you post result of driving display we can do some other on sequential about loading register from external. About your sentence on last line, on board there where none IP nor Softcore embedded, you need load your instead of the programmed one. I suppose you intended the HARD core ARM instead of soft core. Edited some part on Jan 7 where text was difficult to read.