Reputation: 1046 Grandmaster
- Active Posts:
- 4,449 (2.51 per day)
- 09-June 09
- Profile Views:
- Last Active:
- Today, 01:36 AM
- OS Preference:
- Favorite Browser:
- Favorite Processor:
- Favorite Gaming Platform:
- Your Car:
- Dream Kudos:
Posts I've Made
Posted 15 Apr 2014You have floating point variable which contains the total change. You need to find a way to break down that change into a sum of different quantities (500, 200, 100, ... .25, etc...).
Forget the program for a second. And answer me this,
If I gave you a check for $1020, and said go to the bank and give me the cash in the largest bills possible, how would you determine how many $100 dollar bills to give me? How many $50 dollar bills? How many $20 dollar bills?
What math operation did you do in your head to figure this out?
Posted 15 Apr 2014Its actually pretty simple to implement a CPU onto an FPGA. You just develop all the components separately (program counter, ALU, memory, control unit, etc..) in VHDL (or Verilog), then you just hook it all together and pray it works.
Posted 15 Apr 2014
Quoteyou are also using a "Reference operator" & in your functions declaration for size, shouldn't be needed.
You must pass pointers by reference (or pass a double pointer) if you plan on changing where the pointer points, therefore the & is necessary. Remember, pointers are passed by value.
QuoteDo some searching around on google to get a better idea on how dynamic memory works and what reference operators are actually needed.
I recommend taking your own advice
One major problem I see is that you never initialize your size variable. Be sure you initialize it to zero at the start of your program.
Posted 14 Apr 2014If for some reason you can't pass a pointer as an argument, you could use bitwise operators to encapsulate both return values into a single integer.
Posted 13 Apr 2014No, that sounds awful.
However, I once wrote my own soft core CPU on an FPGA. Then wrote the game snake in the assembly interpreted by the soft core CPU
- Member Title:
- 24 years old
- January 9, 1990
- Years Programming:
- Programming Languages:
- C/C++, Java, MIPS assembly, VHDL, AVR C
- Website URL: