Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 2    [LBP2] Help!
#1

Math Logic

Archive: 9 posts


Hi I?m current working on a Pokemon level and I hit a snag when it came to multiplying and dividing using logic. I have had no problem with subtraction or addition but I still need whatever system I use has to be able to use them. I need help in thinking of a system as I can?t seem to get it to work with timers.2012-03-02 22:47:00

Author:
Unknown User


I don't know the logic myself, but I would recommend taking a look at the Creator's Toolkit (http://lbp.me/v/8s5ec2). It has pre-made logic that does all sorts of things, including multiplication and division.2012-03-02 23:14:00

Author:
SuddenEnigma
Posts: 70


Thanks ill check it out.2012-03-02 23:35:00

Author:
Unknown User


Multiplication is repeated addition. Division is the same as multiplying by a fraction. Whether it's faster to repeatedly add or use something like lattice multiplication depends what kind of numbers you're dealing with.2012-03-03 15:24:00

Author:
Ayneh
Posts: 2454


I checked out the level and it only have logic for x10 and /10.


Multiplication is repeated addition. Division is the same as multiplying by a fraction. Whether it's faster to repeatedly add or use something like lattice multiplication depends what kind of numbers you're dealing with.

Well I hope to be working with number up to about 10,000. so it would take a while with repeated addition.
2012-03-03 17:35:00

Author:
Unknown User


Well I hope to be working with number up to about 10,000. so it would take a while with repeated addition.
For the sake of speed you'd always make the multiplier the smallest number, so the largest multiplier you'd be dealing with to reach 10000 would be 100. 100 steps of repeated addition would take 3 seconds total to calculate assuming each step takes 1 frame.

If that's too slow something akin to lattice multiplication will reduce the number of steps to arrive at a result. There's lots of information online about this. A summary of a few different multipliers can be found here: http://lsmwww.epfl.ch/Education/VLSIDesign/ch06/ch06.html#6.7
2012-03-03 19:42:00

Author:
Ayneh
Posts: 2454


Hum, my multiplying logic is instantaneous as far as I know, I just use loads of adders in a row. I have a divide chip, inspired by rtm's logic blog. The division uses timers, so you can't divide by every number since timers aren't accurate. You can't divide by 10 with it, but you can divide by 90 and multiply by 9 afterward, which is precise enough. And crusher made a round-up logic, in case you want to have a perfect-% signal. All of these are found in my health meter toolkit - in the "other logic" chip, math category and signal category.

I don't know why, but everytime I send logic to the Creator's Toolkit, they say "great!", they capture it and they don't publish it. There's a broken compare tool in there since 1 year ago, and even if I told it to every member, even if I gave them a fixed version, well they didn't remove the broken one. Wondering why. Whatever, I'm not sure they placed my division logic in it even though I gave them 5 months ago. Blah. And I'm supposed to be part of the team, but they don't ever tell me stuff, such as new versions coming...
2012-03-03 21:01:00

Author:
Unknown User


For the sake of speed you'd always make the multiplier the smallest number, so the largest multiplier you'd be dealing with to reach 10000 would be 100. 100 steps of repeated addition would take 3 seconds total to calculate assuming each step takes 1 frame.

If that's too slow something akin to lattice multiplication will reduce the number of steps to arrive at a result. There's lots of information online about this. A summary of a few different multipliers can be found here: http://lsmwww.epfl.ch/Education/VLSIDesign/ch06/ch06.html#6.7

I think I may have found a faster way Peasant Multiplication (http://en.wikipedia.org/wiki/Multiplication_algorithm#Peasant_or_binary_multipl ication). Will basicly reduce the logic into x2, /2 , subtracting and adding.
2012-03-03 21:20:00

Author:
Unknown User


I think I may have found a faster way Peasant Multiplication (http://en.wikipedia.org/wiki/Multiplication_algorithm#Peasant_or_binary_multipl ication). Will basicly reduce the logic into x2, /2 , subtracting and adding.
Nice.

A little bit lower on that page is a link to here (http://en.wikipedia.org/wiki/Hardware_multiplier) which has a cute 2-bit multiplier implemented with logic gates which could be fun to build. The external links section has some decent webpages that have block diagrams much clearer than the link I provided: http://www.andraka.com/multipli.htm
2012-03-03 21:58:00

Author:
Ayneh
Posts: 2454


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.