[Fpga-synth] Clocks and Enables

Scott Gravenhorst music.maker at gte.net
Sat Sep 13 18:12:21 CEST 2008


I think I know what the answer is, but I want to bounce this the list:

All of my past synth projects have used a single clock.  The enable signal from the DAC module was always exactly one clock period long.  Because of that, I was guaranteed one and only one rising clock transition during the DAC enable signal (because the DAC used the system clock directly) and there was no need to guard against the DAC enable forcing the computation state machine to start more than once per enable.

At least one future planned synth project will do things differently:

There will be two clocks: a DAC clock and a computation state machine clock (or system clock).

a: The DAC's main is controlling the width of the DAC enable signal.
b: The system clock is faster than the DAC clock.

There are then two conditions to consider depending on the ratio of these two clocks.

1) The system clock is less than twice the rate of the DAC clock.

In this case, there can be only one rising edge of the system clock while the DAC enable signal is asserted.  So I can just sample the DAC enable signal at each system clock to coordinate the starting of the computation state machine.

2) The system clock is twice or more than twice the rate of the DAC clock.

In this case, there can be one or more rising edge of the system clock while the DAC enable signal is asserted.  To avoid restarting the state machine after it has already started, I can code to sample the DAC enable signal at every system clock, if DAC enable is asserted, the system enters a state that samples DAC enable until it is not asserted.  Once no longer asserted, the code can perform initialization followed by whatever computation.

In both of the above circumstances, I think I am advised to use double buffering for the data that will be sent to the DAC.  The computational state machine will clock it's output into the "NextDACval" register (using system clock).  The DAC enable signal with the DAC clock will transfer the data from the output of NextDACval into DACreg which feeds the DAC module.  Of course, it must be known that the computational state machine finishes at least one full DAC clock ahead of the next DAC enable signal.

Am I on the right track?




-- ScottG
______________________________________________________________
-- Scott Gravenhorst
-- GateManPoly - FPGA-based Polyphonic MIDI LA/FM Synthesizer
-- GateMan-III - FPGA-based Monophonic MIDI LA/FM Synthesizer
-- PolyDaWG/8 - FPGA-based 8 Voice Polyphonic MIDI Synthesizer
-- FatMan: home1.gte.net/res0658s/fatman/
-- NonFatMan: home1.gte.net/res0658s/electronics/
-- When the going gets tough, the tough use the command line.



More information about the Fpga-synth mailing list