5 ms·
I honestly feel I had a similar feeling when I played Little Big Planet 2 when I was in my late teens. It had a creative mode where you could use basic logic ga
by johnsonjo 6y ago
I honestly feel I had a similar feeling when I played Little Big Planet 2 when I was in my late teens. It had a creative mode where you could use basic logic gates like and gates and or gates, and other utilities like counters and the like (including not just digital inputs but also analog ones). Understanding inputs and outputs from a chip level was quite interesting to me. I tried to make a calculator and learned all about bit adders and such, but was never able to figure out as a teenager how to make a conversion of the binary bits to decimal so that I could display it. I'm still not entirely sure what the proper algorithm is for that (if by chance anyone knows that would be nice to know), but I'm sure I could find it out now that I have a degree in CS (just saying that's plenty sufficient but not necessary to have a degree).
- indiv0 6y agoYou'd use a BCD to 7 segment display circuit [0]. At least that's what we did in my digital systems design course. Depending on what number you're trying to display you light up different parts of the segmented display. [0]: http://electronics-course.com/bcd-7-segment http://electronics-course.com/bcd-7-segment
- johnsonjo 6y agoSweet! Thanks for sharing! I’ll have to look into this more when I have time. I think the missing key for me was the BCD part. I had figured out how to do the seven segment display at some point using other utilities that LBP2 had.
- gnramires 6y agoA general formula is: d1 = n % 10 d2 = n/10 % 10 ... dk = n/10^(k-1) % 10 There are a number of implementations possible, iterative is probably more economical. Another way that avoids integer division (if you just want +/-/* ) is doing all your arithmetic in BCD (binary coded decimal), using 4 bits per digit. I think those kinds of exercises are useful because there is some confusion around arithmetic. Sometimes there's confusion between what are numbers, and what are number encodings or digits (which themselves represent individual numbers). I found myself confusing (or simply not having the concept of differentiating) the digits of a number and a number itself. Say '14' to me was uniquely associated to those two digits. When you learn binary arithmetic, you start generalizing and see it could be written '1110' as well. The number 18 is a concept independent of its representation. So you can talk about the digits of a number: the digits represent individual numbers themselves, but they are taken together to represent another number. In my example, I had 'dk' and 'n', where n is a number that will usually be represented in binary form, but that is irrelevant, and 'dk' are their digits, as numbers, also usually represented in some binary form (again might or might not be relevant). You even consider simpler encodings such as unary (e.g. as used in tally marks or finger counting), those of course have lower efficiency (O(logn) vs O(n)). They're all just representations of this abstract concept that are numbers (with which we can do mathematics and arithmetic operations). I think it's illuminating to distinguish between digital properties (properties specific to a digital representation), and properties of numbers. For example, 4 in base 3 is 11, which violates the property that even numbers are those whose last digit is even (only true for even bases). Divisibility by two is a numerical property, last even digit (implying evenness) is a digital property. Numbers are so simple conceptually, it's their digital representation (and digital arithmetic) that's a bit more complicated.