On Aug 19, 2004, at 12:36 PM, Herbert Graf wrote: > The module has a Zilog eZ80F91 part on it with a 50MHz crystal. I've > been scouring the datasheet to answer one silly question: what > instruction rate does 50MHz system clock get me? I know not all the > instructions are single cycle. > Looking at the eZ80 CPU manual, and remembering from ye-olde z-80 chip, it looks like things are highly variable. This is an old-style CISC CPU, and this is one of the things that is normal with CISC. I read that there's a fetch, decode, and some number of execution cycles. Normally, instructions are prefetched and pipelined, so the fetch and decode operations overlap with the execution of previous instructions, but that may change drastically for a tight loop. Only the register to register operations are 1 cycle, as far as I can tell. A call instruction takes 5 to 9 cycles, depending on exact form (and presumably flushes the pipeline as well.) I couldn't tell for sure whether "cycle" means one oscillator clock cycle, or whether there is some further division. On the original Z80, there were several different types of "machine cycle" some differing number of clocks for each type. Most were about 4 clock cycles. But the ez80 does specifically claim to be 4x faster than the original z80. Memory wait states and such come into play as well, and I couldn't find for sure whether the internal memory has any wait states... > > The reason I ask is I have a program (in C) that wiggles a pin up and > down, and when I put a scope on it it's frequency is only about > 50kHz!!??? Am I doing something wrong or is the MCU REALLY that > inefficient? Does the chip come up is some "slow" default mode or > something? 50kHz, at a 50MHz clock, would imply about 1000 clock cycles to output one cycle on the output pin. If a cycle is one clock cycle, that would be several hundred instructions, which doesn't seem very reasonable. On the other hand, it's not completely impossible, either, especially if some of those execution cycles turn out to be more than one clock. Recall that the z80 architecture lacks anything other than load/store to the io ports, so there is no way for the code to toggle individual io bits. You could be looking at a C function call to read and write the io port for each half-cycle. BillW -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics