# Problems understanding the material

4 messages
Open this post in threaded view
|

## Problems understanding the material

 Hii all, I think I have some fundamental problem understanding the whole gate-logic or something... I did the whole of project 1 by looking at the truth tables and figuring out which combination of gates I should use. For the multiplexer I used the disjunctive normal form to determine how to connect the gates though I find the de-multiplexer a little "eh..". Doing the first part of the second project was kind of ok, had to look up for help on the web and then I just got stuck with the ALU. I had no problems doing project 4 with the assembler, so I guess that hardware is my problem. I have no idea which chips to use when and more importantly WHY to use them. I don't really understand the contribution of each one of them (I mean, if I see some requirement, I don't have that "ohh! I should use that and that chips" thinking ). And I don't really understand how if-else statements could be translated to connections via chips and so on. I am literally panicking here because it's a uni-course and my grade is dependent on that. I looked up some answers that other people posted, but it didn't contribute to my understanding at all. Does anyone have some tools or tips that I could use? I have read the first 4 chapters of the book and sat down in lecture =/ thanks
Open this post in threaded view
|

## Re: Problems understanding the material

 It takes a little time to wrap your mind around hardware. The "if-else" for example works quite differently than from software. Instead of selecting which part to execute (the software way), you generally compute both parts and select which answer to use depending on the condition. One way to do this is to use a multiplexer. Demultiplexers on the other hand are useful to "route" the value to one of several possible outputs. This is useful in chips like RAM, where you want to select exactly one of the cells to be written to. For the ALU you just need to go from the inputs. For example, the first function line in figure 2.5 reads "if zx then x = 0". So you need to select (think MUX) either x or 0. You can use constants like true and false to obtain the 1 or 0 that you need. From then on, you treat the output wire of this "if" as the current value of x. Next you need to negate it if nx is 1 or to leave it unchanged otherwise. Sounds like another small "if-else". The same goes for y. Then you get these two values and feed them in the next "if-else" and you go on like that. Focus on the output out first. When you have it working, you can think how to compute zr and ng. As for tool I can recommend logisim. It's quite good to visually see what's going on. You can also try the book Code by Charles Petzold. It explains a lot of the same concepts, so you may find it more understandable. In any case, don't give up!
 Administrator In reply to this post by lata22 I think I have some fundamental problem understanding the whole gate-logic or something... I did the whole of project 1 by looking at the truth tables and figuring out which combination of gates I should use. For the multiplexer I used the disjunctive normal form to determine how to connect the gates though I find the de-multiplexer a little "eh..". For chips like DMux that have multiple outputs, first think of them as N independent circuits. After you have equations for them, then look for common subcircuits chared between 2 or more of the outputs. And I don't really understand how if-else statements could be translated to connections via chips and so on. Sounds like you have some programming experience. Are you familar with "const" or "final" variables?  Hardware is like writing code with only const variables. So The comments in ALU translate to something like ```final int x1; if (zx == 1) { x1 = 0; } else { x1 = x; } final int x2; if (nx == 1) { x2 = ~x1; } else { x2 = x1; } ... ```As Ivan said, hardware makes you think different. Another approach is to think backwards. For the ALU:     out = function output or not function output, depending no 'no'.     function output = And16 output or Add16 output, depending on 'f'. ... You can even write the HDL in that order since it is a set of wiring instructions, not a linearly executing script. I have no idea which chips to use when and more importantly WHY to use them. I don't really understand the contribution of each one of them (I mean, if I see some requirement, I don't have that "ohh! I should use that and that chips" thinking ). For chips like Bit where a diagram is presented, it makes sense to write the HDL from the diagram, leaving blanks for unknown / unnamed parts. ```PARTS: // Put your implementation here. Mux(_a_or_b_=out1, _a_or_b_=in, sel=load, out=dffIn); DFF(in=dffIn, out=out, out=out1); ```Note that this is hardware and you can solder more than one wire to "out=". Then by thinking about how the Mux's "sel" works and when the Bit should load a new value, you can assign "a" and "b" inputs correctly. If you have trouble conceptualizing how the synchronous sequential logic works, ask and I'll post a follow up. I second Logisim and Code. Also useful may be play-hookey--Mark