Re: General: Understanding of CPU/Memory communication
Posted by WBahn on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/General-Understanding-of-CPU-Memory-communication-tp4037477p4037478.html
You are asking very good questions. To answer one of them -- the Hack is a strictly 16-bit machine and all of the tools that you are asked to develop are also strictly 16-bit. This, very much, is for simplicity.
Having said that, you could write Jack libraries that work with different-sized data. This is done, in fact, in the character output library where information about two characters are stored in the same word. You could write libraries that work with single-byte data, four-byte integers, or 64-bit double-precision floating point numbers. Implementing things at this level is usually referred to as "emulation" -- you are emulating hardware behavior with software. Early PC's had no support for working with floating point representations, so this was done in software.
The degree to which the hardware supports working with different-width data depends very strongly on the processor. In general, the lower the cost of the processor, the more likely it will only support operations on it's native data width. At the other end, processors like the x86-64 have very rich instruction sets that support working on data of several different widths, primarily 8-, 16-, 32-, and 64-bit integers.
You had asked if a processor could have registers that are a different size that it's bus-width. There's nothing that prevents this, but it is uncommon. Instead, smaller-width values use a portion of a full register while wider-width data is split across multiple registers. Having said that, the x86-64 has sixteen floating-point and vector registers that are 256-bits wide.