The lowest level that softHARDsoft will implement is transistors. They work on pure physics and going any more basic than that seems a bit silly for our purposes.
Transistors can be used as amplifiers or switches. They are the bedrock of the rapid advancement of electronics over the last 60 years. These tiny wonders can be used to amplify signals (as they are used in transistor radios and hearing aids) and can act as on/off switches (as is the basis for computer logic).
In Transistor choice, it was explained that we'll start with bipolar junction transistors (BJT transistors). These have the most basic construction of all transistors and for our purposes, they'll work as well as any of the others. In fact, they'll work better than the others because they'll be the easiest for which to to write emulation software. I'm going to spend as much time as necessary getting a rock solid transistor emulator working. It cannot be emphasized enough that all computer logic comes back to transistors. Everything.
Anatomy
A BJT transistor has 3 regions: emitter, base, and collector. Here's how an NPN* BJT transistor works: When current is available at the collector, applying a tiny current to the base causes the emitter to emit an amount of current equal to the sum of the other 2. The sum of the currents is how amplification occurs. More importantly to us: the transistor acts as an on/off switch when we add power to or remove power from the base.
Now that we have a switch that is activated by electricity, we can use electricity to take action on other switches.
* There are 2 types of BJT transistors: NPN and PNP. The choice for which to use is arbitrary so we're using NPN.
Friday, July 25, 2008
Friday, July 18, 2008
How to make a machine "think"
LogicI know we've really already predicted the answer to the question "what do we need?": we need the parts that make up a computer. But we haven't determined why those parts the most appropriate? Why transistors? What benefit do we gain from them? What will they allow a computer to do? For that matter, what do we need our computer to do in the first place?
What computers do is obvious. It's right there in the name. They compute. They take input data, make decisions, and give output data. To make decisions, there needs to be some kind of predictable logic.
What kind of logic can a machine use? This logic needs to be a type that a non-thinking thing can do on its own. There needs to be well-defined concrete input data. If we want to make complex decisions then we need a type of logic where the output data from one decision can be the input to another. To that end, no output can be undefined. If it were so, then we could have undefined input which we've already said we don't want. Our options for well-defined input/output is seemingly limitless: letters, numbers, words, etc. Is one type of input more useful than another?
Conveniently enough there is an existing logic we can turn to for help. This type of logic is well established, is fundamental in math and language, has very few rules, and the rules it does have are all simple: Boolean logic (also known as binary logic).
In Boolean logic, data can be either TRUE or FALSE (alternatively: 1 or 0, on or off). Our TRUE and FALSE can relate to each other in a small number of rules that resemble pre-algebra. In keeping with the obvious minimalist theme of this logic, there are only a few relationships (aka: operations) and each is based on only 1 or 2 inputs at a time. With the NOT operation, you can turn one input into its opposite. You can also see if two inputs are the same as each other (XNOR), if both inputs are true (AND), if at least 1 is true (OR), or if one is true but not the other (XOR). Really, XOR and XNOR can be derived from the other 3, so there are only 3 fundamental operations.That's it. There's 100% of the basics of Boolean logic.
Although this feels very limiting compared to the possibility of using numbers and words, this is in fact all we need. For now please trust me. It'll be more apparent later.
SwitchesEnough with the theoretical stuff, how do we get a machine to implement binary logic? Obviously, the on/off state of our data calls to mind light bulbs and light switches. All that remains is to figure out how to implement the 3 logical operations mentioned previously (NOT, AND, OR).
It turns out that the key to implementing the logical operations with electricity is just a matter of using switches wired up certain ways. If you want an AND situation, hook up 2 switches in serial. For OR, hook up 2 in parallel. For NOT, just change the switch's current position.
Electronic Switches: FINALLY, Our 1st hardware
Unless you want to sit there manually toggling switches all day, we need a way to have that part done for us automatically. We want switches that themselves can be controlled by electricity.
Enter: transistors.
And that's where we'll pick up next time.
Tuesday, July 15, 2008
Transistor choice
As I said in I know nothing, the inspiration for softHARDsoft comes from Charles Petzold's Code: The Hidden Language of Computer Hardware and Software. Throughout the book, Petzold designs a computer out of relays. Toward the very end of the book he reveals that transistors and not relays make real computers these days.
Although I knew this fact, what I didn't know until fairly recently is that the transistors of modern computers are not just the common BJT transistors* described in hobbyist electronics books. In actual processors, MOSFET transistors are used. Especially when MOSFET transistors are arranged in CMOS logic, there are significant gains in electricity usage and heat released. These are huge concerns when you're stuffing a few hundred million of these jokers into a couple of square inches. Not such a concern for sHs where all hardware is virtual.
However, that leaves me with a dilemma: do I try to really emulate a processor by creating the internals of my logic gates using MOSFET+CMOS logic, or just plain old BJT-styled transistors? For now I'm going to do the latter and revisit the issue later if I feel like it. I feel I can justify this choice because I am in fact looking at design a computer. It doesn't have to be accurate to modern computers. In fact, this whole project is ambitious enough without trying to hold myself to such standards; especially at the beginning.* I realize that "BJT transistor" is redundant since the T stands for "transistor." But to amateur ears like mine, the sentence flows better than calling them "BJTs." Likewise with "MOSFET transistors" vs. "MOSFETs."
Thursday, July 10, 2008
Follow-up to Code?
Almost a decade after the fact, it's no real surprise that Charles Petzold doesn't intend to do a sequel to Code, however it was still disappointing to hear when I asked him directly. His email reply to me:
Oh well. I'm sure I'll still read this book when I find time.
You can purchase The Annotated Turing from Amazon or through links on the official site.
[Update: Charles Petzold stated as much here a year ago but I only just became aware this post of his.]
I don't think this is precisely the book you're looking for, but I *do* think of my new book as a sequel to code:
http://www.TheAnnotatedTuring.com
Oh well. I'm sure I'll still read this book when I find time.
You can purchase The Annotated Turing from Amazon or through links on the official site.
[Update: Charles Petzold stated as much here a year ago but I only just became aware this post of his.]
Monday, July 7, 2008
Hiatus
I got into a pretty severe wreck over the holiday weekend. We're all ok but this has left me with a long to-do list of things more important than sHs. I'll still post here when I get around to it but who knows how frequent that will be.
Ford Crown Vics don't get very good gas mileage but they protect you really well from damage. This easily could have been fatal.
Ford Crown Vics don't get very good gas mileage but they protect you really well from damage. This easily could have been fatal.
Wednesday, July 2, 2008
I know nothing part 2: A tribute to Dion Polk and Robert Rodriguez
In college I had one class with a guy who did webpages as a hobby: Dion Polk. He was an older guy ("older" compared to a kid fresh out of high school) that I hung out with after class quite a bit. I owe him a lot. What did he do for me? Very little actually. We'd talk after class, I'd ask him questions about how he wrote webpages, and he enthusiastically answered my questions. The big thing he did for me was write down a url for an online tutorial for HTML. You can hardly go online now without tripping over a million such tutorials, each one equally as good as the one I saw then, but back in the pre-Google days of the internet, such wasn't the case. Back to my point: Dion's can-do, can-learn attitude reinvigorated my passion in technology.
Flash forward some [mumble, mumble] years to watching the extras on the DVD of Sin City. Love it or hate it, Sin City is a visual masterpiece. On the DVD, co-director Robert Rodriguez spends some time explaining his mantra of "Mariachi-style" movie making -- where "creativity, not money, is used to solve problems." He talks about how he got into the movie biz and tells how he did pretty much all jobs himself. Then he casually mentions how the viewer can do pretty much all effects seen in Sin City using an inexpensive camera and the free software that's probably already on their laptop. I was floored! He's really suggesting that your average person can do this. In fact, he himself did this in many professional movies -- including for all the stunning visuals in Sin City.
Although I was interested in computers since childhood and got pretty good with certain aspects, especially for a kid, I largely abandoned computers for my teenage rock n' roll years where I spent most of my non-school time playing in bands. In fact, throughout high school the only programming I did was writing pseudo-BASIC scripts on a graphics calculator to figure out my math formulas for me. Learning all this "computer stuff" in college was really starting from scratch. But I did it. One step at a time. From then until now I have faced countless times where I started out completely deficient in the knowledge needed for my desired field. Until I learned more. Now I have a fledgling skill-set I'm starting to be proud of. Not because I'm special or overly smart - I'm not. Not because I learned it in school - I didn't. It's because I said I can - and I did.
Flash forward some [mumble, mumble] years to watching the extras on the DVD of Sin City. Love it or hate it, Sin City is a visual masterpiece. On the DVD, co-director Robert Rodriguez spends some time explaining his mantra of "Mariachi-style" movie making -- where "creativity, not money, is used to solve problems." He talks about how he got into the movie biz and tells how he did pretty much all jobs himself. Then he casually mentions how the viewer can do pretty much all effects seen in Sin City using an inexpensive camera and the free software that's probably already on their laptop. I was floored! He's really suggesting that your average person can do this. In fact, he himself did this in many professional movies -- including for all the stunning visuals in Sin City.Although I was interested in computers since childhood and got pretty good with certain aspects, especially for a kid, I largely abandoned computers for my teenage rock n' roll years where I spent most of my non-school time playing in bands. In fact, throughout high school the only programming I did was writing pseudo-BASIC scripts on a graphics calculator to figure out my math formulas for me. Learning all this "computer stuff" in college was really starting from scratch. But I did it. One step at a time. From then until now I have faced countless times where I started out completely deficient in the knowledge needed for my desired field. Until I learned more. Now I have a fledgling skill-set I'm starting to be proud of. Not because I'm special or overly smart - I'm not. Not because I learned it in school - I didn't. It's because I said I can - and I did.
Subscribe to:
Posts (Atom)