Nand2Tetris CPU Emulator Clock Frequency

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Nand2Tetris CPU Emulator Clock Frequency

henryt
What frequency does the CPU emulator run at when there are no animations and the slider is set to fast?

I am creating the Nand2Tetris computer on breadboards (sort of like Ben Eaters breadbaord computer) and I want to know roughly what clock input to use.
Reply | Threaded
Open this post in threaded view
|

Re: Nand2Tetris CPU Emulator Clock Frequency

WBahn
Administrator
It just runs as fast as it can. How fast depends entirely on your computer and what else you are running.

You can figure it out by printing out the 'time' variable to the output file at the end of a simulation and then either manually timing how long the program runs or writing a batch file that captures the time before starting the emulator and again after the emulator exits. There's some start-up and wrap-up code that pollutes the data, but if the program itself runs for a long time that will get lost in the noise.
Reply | Threaded
Open this post in threaded view
|

Re: Nand2Tetris CPU Emulator Clock Frequency

henryt
Okay thanks, that makes sense. I will try and get a rough number with some experimentation.
Reply | Threaded
Open this post in threaded view
|

Re: Nand2Tetris CPU Emulator Clock Frequency

Zorro
Did you sucessfully finish your breadboard Hack-Computer? This thread is a little older, but just for the case that you're still working on it...

I have actually no idea which components you are using for your computer, but I believe that the final clock cycle you should choose will belong to the logic IC's. Maybe you should study the datasheets from the chip manufactures?
Reply | Threaded
Open this post in threaded view
|

Re: Nand2Tetris CPU Emulator Clock Frequency

WBahn
Administrator
The max clock frequency will be set by the propagation delay of the longest path from any register output to any register input, taking into account the setup and hold times of the registers themselves. So the timing information in the datasheets is critical, but no where near sufficient. The logic design will have to be analyzed to first identify the critical path and then determine the worst case signal delay along that path.

Reply | Threaded
Open this post in threaded view
|

Re: Nand2Tetris CPU Emulator Clock Frequency

henryt
Yes I understand that. I am not concerned with the maximum frequency of the circuit as I am sure that it will be higher than the clock speed of the CPU Emulator. I am just curios as to what speed the CPU Emulator runs at so when, for example, I run the Pong.asm example it doesnt run at like 10x speed or something. I am still building the circuit right now, lots of crucial bits have been completed but it is not finished.
Reply | Threaded
Open this post in threaded view
|

Re: Nand2Tetris CPU Emulator Clock Frequency

henryt
In reply to this post by henryt
EDIT:
Just for clarity because my question was not clear. I am not talking about the frequency of the circuit that I am creating, I know that is dependent on the chips that I am using etc. I was referring to the clock speed of the CPU emulator itself. I just want to know what clock to run the computer at so that the programes dont run too fast or slow. For example, if I ran the breadboard computer at 3MHz (I am just picking a number, this is on the upper range of what the chips I am using are capable of), I am sure that the Pong.asm game would be unplayably fast. Hope that explains it better.
Reply | Threaded
Open this post in threaded view
|

Re: Nand2Tetris CPU Emulator Clock Frequency

WBahn
Administrator
Why are you sure that the Pong game would be unplayably fast at a 3 MHz clock speed.

Have you measured the speed of your emulator? I told you how to do this at the beginning of the thread.