The implementation of the processor architecture from Charles Petzold's book Code. The secret language of computer science "

About the book

Probably many of those who are fond of studying how a computer works at the lowest level have read books such as: Tanenbaum "Computer Architecture" or Harris, Harris "Digital Circuitry and Computer Architecture", which are undoubtedly comprehensive works and good books for learning ... But if you are not an engineer, but still want to dive into the world of digital computing and understand more deeply how a computer works. Chalz Petzold's book "The Code. The Secret Language of Informatics" can help you with this, which begins its story from the reasons why people needed to exchange information and process it, what problems they faced and ends with stories about the device of real operating systems and processors and their architecture.At the same time, the author perfectly matched the level of abstraction, which he adhered to when writing. In some moments, describing in detail the work of the elementary parts of the processor, and in others, telling in simple words about complex things.





Description of architecture

So in Chapter 17 "Automation" the author, starting with a description of how to automate the summation of data with intermediate storage of state between operations, proceeds to the implementation of an architecture with a set of instructions sufficient to execute almost any computation. This architecture differs from those used in that the dimensions of the address bus, data bus, and machine word have different dimensions. Memory access is byte-wise, which is fairly common. A fixed-length little-endian machine word consists of 12 bits or 3 bytes, divided into two parts. The least significant byte of the word contains the operation code contains the command number, the upper two - its argument. Due to the limitations of the data path, 4 counter cycles are spent per processor cycle, of which 3 are spent on reading the command and 1 on executing calculations.The architecture describes one software-accessible general-purpose register in which the results of operations with the ALU are stored, as well as 2 flag registers that are analogs of the C and Z register CPSR of the ARM architecture and indicating whether the result of the last operation performed using the ALU had a bit carry or equal to zero, respectively. The architecture describes 12 commands, which can be logically divided into 4 groups:





































  • ( )









  • 0









  • 0

















, 8 2^8=256, 256-12=244 , ,





  • (AND)





  • (OR)





  • (NOT)





  • (XOR)

















N - V - . , , .





, , - , . .





. 22 " " . . 0 1, . , . .





, , . .





, .





Quartus II 13.0sp1, . VHDL Verilog, . :





  • lpm_mux (. multiplexer)





  • lpm_decode





  • lpm_counter





  • lpm_ff (. flip-flop)





  • lpmaddsub





  • lpm_constant





ModelSim, . In-System Memory Content Editor .





Cyclone II EP2C5 Mini Dev Board EP2C5T144C8, 50 , 80 / JTAG . , , 13 16 , . .





. 16 + 8 + 3 = 27 , 8 .





MTS-102 ON-ON. , - . , , .





, . , , , , , .





5 , .





, Autodesk Fusion 360 .





GX16 5P, USB .





. , - . , .





. .





Cyclone II EP2C5 Mini Dev Board EP2C5T144C8. , . , .





, powerbank'a, 5 , 18650.





Autodesk Fusion 360 , .





, , .





, . . , . , , , IoT.





Special thanks to blogger Stas Vasiliev for recommending this book and inspiring work on this project. Because now one of the most important tasks is to get engineers interested in working on interesting projects.












All Articles