| ??? 10/21/07 01:38 Read: times |
#145962 - re: ANSWER, Part II Responding to: ???'s previous message |
Andy said:
Do that in your server by changing data and strobe only after the rising edge of the clock:
initial begin
data <= 0; // note: do NOT assign sysClk here!
strobe <= 0;
@(posedge sysClock);
@(posedge sysClock);
@(posedge sysClock);
@(posedge sysClock);
data <= 1;
strobe <= 1;
@(posedge sysClock);
strobe <= 0;
@(posedge sysClock);
@(posedge sysClock);
@(posedge sysClock);
data <= 2;
strobe <= 1;
@(posedge sysClock);
strobe <= 0;
#10 $finish;
end // initial begin
Simulate this, and you'll see the results you expect. Indeed I did see the expected results! So I went back and reworked all of my testbenches to use this technique for establishing the timing of the signals they generate. After I did that, all of the crazy and confusing behavior I had been seeing magically went away. This was a very good thing. I've been writing (and rewriting, and rewriting) little modules that correspond to the functional blocks in the diagram of the Morse code decoder proposed here. So far, I have modules and individual testbenches done for the RS232 transmitter, the decoder, the event FIFO, the character translation table, and a clock divider. (The clock divider doesn't appear on the diagram.) I also have an evolving top level module that ties other completed modules all together. I have been using it as a kind of "super testbench", and I think it can eventually become the top level module for the completed project. Someday when I get all this working, I'll post the code for a critique. -- Russ |



