Hot answers tagged

37

No matter what base system you use it is called a digit. So if it is not clear from the context and you need/want to emphasize that it is a digit of a number in base 8 representation then call it octal digit. Note: Also "bit" is just short for "binary digit".


25

Memory addresses are binary numbers. The range of an N-bit (unsigned) binary number is 0 to 2N-1, a total of 2N different values. Since addresses are passed to memory chips as binary numbers, it makes sense to build them in capacities of powers of 2. That way, none of the address space is wasted, and it's easy to combine multiple chips/modules to build ...


24

Ah, you're missing the STATE MACHINE concept. That's where we can "write code" made out of TTL hardware chips: data-selectors, 4-bit counters, gangs of parallel flipflops. (But all those are the complicated parts, while the idea behind "state machines" is fairly simple.) "State-machine" is also commonly called "micro-code." Also called "bit-slice" or "...


13

A 1024 x 1 memory chip requires 10 address lines and you get full utilisation of all addresses. Now, if someone brought out a 600 x 1 memory chip, it would still need 10 address lines. It can’t use 9 because that could only uniquely define 512 memory positions. Then think of what would happen if someone wanted to use two of the 600 x 1 memory chips to give ...


7

A processor is really a finite state machine (FSM) for implementing the machine code instructions. It reads the instructions from memory and uses the required hardware, such as the ALU, to implement them. Here is the data path of the MIPS architecture. source You have a control unit implementing said FSM and is responsible for ensuring the data is ...


6

Both have their uses: The second gives potentially better hardware in a real-life scenario, the first can be given to students as coursework for a course named "history of hardware" or something equivalent. For the second example, the synthesis tool will implement an addition in whichever way works best for the set boundary conditions. This might be a full ...


5

Your original sample is too small to know if it's FLAC or not. You need a long sample, and then look for 0xff 0xf8 bytes in it to see if you have FLAC block headers. Your additional sample from the beginning of the streadm is definitely FLAC. FLAC is a complex format for compressing audio (format overview), with many variations on sample size and so on. ...


4

The actual binary machine code instruction set, and/or the sub-fields that compose the instruction set, are usually encoded in look-up tables (software arrays), or switch/case statements. After parsing the human-readable text into tokens, numerical forms of these tokens can then be used to index into the lookup tables for the binary encodings. The binary ...


4

With 1 address wire you can access 2 different addresses. With N address bits or wires, you can access 2^N different addresses. Not much more complex than labeling 10 different items with single decimal digit or 26 different items with a single letter (depending on how many letters you have in your alphabet of course).


4

According to the Obsolete and unusual units section of the Units of information wikipedia page, an octal digit (3 bit word) has been variously described using the terms: tribit, triad, triade, and tribble. which all fit quite nicely. Having said that, having been a programmer for over 30 years I have never come across any of these words being used in this ...


3

the souce code is translated into machine code using a compiler or an assembler (or some combination) this machine code is a different pattern of ones and zeroes In the tha CPU the the instriction decoder marshalls the machine code into actions takes by the ALU registers, i/o etc. The instriction decoder it typically a bunch of gates.


3

Here's something that the other answers haven't touched on yet... there's also something called synthesis which is one way to code the actual transistors and their physical layouts. You write the design in a Hardware Description Language (usually VHDL or Verilog). Then either you configure a Field Programmable Gate Array (FPGA) or you have actual hardware ...


3

As others have already said, the key is probably to understand what a logic gate is, and how transistors are used to build one. Logic gates are the fundamental building blocks of anything digital. A logic gate simply takes one, two, or occasionally more binary input values, and produces an output according to a predefined rule (called a truth table). The ...


3

Yes, machine code is 0's and 1's. The step from here to electrical signals is small; each 0 may be 0 volt and 1 may be 1.8 volt (or the opposite!) They are so similar that no "translation" is needed here. In a 32-bit architecture the instruction bus is 32 bits wide; in other words there are 32 individual lines, each with one of these voltage levels. The ...


3

Transistors are used to build logic gates. Gates are used to build logic circuits and memories. A modern CPU is, loosely speaking, built as two parts (1) a datapath that does maths and loads and stores values in memory (also made of transistors), and (2) control circuits that configure that datapath based on machine instructions (which are the 1s and 0s ...


3

You didnt state your "rules" so we dont know how to understand "new rules", complete solution, etc. If you use a flag based architecture then both C and V are important/desired. If not a flag based architecture you still compute them but do the comparison in the same instruction. As you perhaps understand, in binary math, that first off you dont subtract ...


3

In the simplest versions it would enter an infinite loop because you repeatedly subtract divisor from the dividend until the dividend until the dividend is zero and count how many subtractions took place. But if the divisor is zero then the dividend never reaches zero so it continues trying forever: Mechanical calculator dividing by zero In better ...


3

There are two outputs from a half-adder. These are sum and carry. Assuming A and B are the inputs, then their output tables look like this: $$ \begin{align*} {\begin{array}{c|c} { Sum } & { \begin{smallmatrix} B\\ \begin{array}{cc} \overbrace{\begin{array}{cc}0 & 1\end{array}} \end{array} \end{smallmatrix}...


2

what happens to the carry outs? You can combine n full adder circuits to make an adder for n-bit numbers. When you do this, you connect the carry-out from each adder to the carry ins of the adder for the next most significant bit. Here's an example adding 2 3-bit numbers, X = A + B: simulate this circuit – Schematic created using CircuitLab why ...


2

All three inputs to the adder have equal weight, 1. The output will represent how many are 1, so the counts, 0, 1, 2 or 3. Expressing those counts in binary, we have 00, 01, 10 and 11. You can regard the carry and sum outputs, in that order, as those two bits of binary, with carry having weight 2, and sum having weight 1. So finally, we can read the ...


2

The rows do not indicate any kind of sequence or relationship. This is simply a table of 3 inputs (A, B, CarryIn) and two outputs (Sum, CarryOut). We could put the rows in any order and it wouldn't matter. Simply count the number of 1 bits in the three inputs. If there are two or three ones then the CarryOut will be 1, else it is 0. It there are one or ...


2

In the end: nothing. Synthesis tools are so good that they will optimize your code to what ever fits best. "Best" then depends on of you have set e.g. optimise for area or speed. In most cases they will try to use the least amount of logic which still meets your timing specification. In real designs you really, really do not want to instance primitives. ...


2

What you're doing is still safe, since you're still performing twos-complement operations on a signed integer, just with hex representations of the integer shown as you perform operations. (0xFFFF - 0xA451) is the same thing as (0b1111_1111_1111_1111 - 0b1010_0100_0101_0001) which is just flipping the bits. Next, adding 0x1 modulo 0x10000 is the same as ...


2

You can use whatever base you want, as long as you use the same limit to your number range. For example, here's how 16-bit two's complement would work with decimal numbers: 2s_comp = 0b10000000000000000 - number = 0x10000 - number = 65536 - number Number Decimal 2s_Comp_Hex 2s_Comp_Dec 0xA451 42065 5BAF 23471 0xE227 57895 1DD9 ...


2

Yes, it is possible. If your input is straight binary (not BCD) and all you have is transistors and logic gates then you will need to start by creating the truth tables for the function you need. The inputs to the truth tables will be the bits of the binary value; the outputs will be the bits of the decimal value. Once you have the truth tables you can try ...


1

Usually we do not pull random 1s and 0s "out of thin air". Binary signals exist for reasons. So what kind of signal do you want to generate? You can make a signal that is always low, or always high, just by connecting a wire to the ground rail, or the power supply rail. You can make one that alternates between 0 and 1 by using a clock. Any signals more ...


1

Short answer in addition to mbeaty and others: There is actually NO other abstraction layer. 1's and 0's are themselves open or closed transistors and high/low voltages somewhere in the computer. On every clock cycle (itself a transistor transition between open and closed) the next memory cell (8 or 16 or 32 transistors in the RAM) is connected (by some ...


1

For single cycle instructions, it’s basically lookup tables, from instruction machine code as the inputs, to lookup table outputs that are all the enables (etc.) needed to select and configure the various chunks of logic (registers, selectors, ALUs, buffers, etc.) required to accomplish the assigned task of the instruction. For multi-cycle instructions, one ...


1

It depends how the source value should be interpreted. If the 4 bits are signed then yes, the MS bit gets replicated. But if the 4 bits are unsigned, the MS bits are set to zero. I write a lot of HDL (Verilog) code and I estimate that about 90% of the numbers I deal with are unsigned.


1

Look for NAND gate, for example in wikipedia: https://en.wikipedia.org/wiki/NAND_gate You will see that this gate is composed from 2-4 transistors. Having NAND gate you can build other logic gates and components. Have fun building whole computer on brilliant page: http://nandgame.com


Only top voted, non community-wiki answers of a minimum length are eligible