Dangerous Prototypes

Other projects => Past projects => CPLD programmable logic => Topic started by: jbeale on April 11, 2011, 08:45:19 am

Title: Simple CPLD project- need some basic help!
Post by: jbeale on April 11, 2011, 08:45:19 am
I'm trying to simulate my first CPLD project for the Coolrunner II board, a 16-bit timer with a start and stop pulse. In case it isn't obvious, I've never worked with CPLDs before.

Here is the schematic of my project, and my VHDL testbench code.
http://bealecorner.org/best/measure/tim ... ematic.pdf (http://bealecorner.org/best/measure/time/CPLD-TIC/CPLD-TIC1-schematic.pdf)
http://bealecorner.org/best/measure/tim ... h1.vhd.txt (http://bealecorner.org/best/measure/time/CPLD-TIC/CPLD-TIC-testbench1.vhd.txt)

Here's the waveform I see from my test inputs:
http://bealecorner.org/best/measure/tim ... -180ns.pdf (http://bealecorner.org/best/measure/time/CPLD-TIC/CPLD-timing-180ns.pdf)

The counter starts and stops, and everything goes as expected until the reset pulse. START_S1B remains high, the top-left flipflop seems to ignore the reset, so the clock cannot be restarted after the first run.  This is a synchronous reset and START_S1B should go low on the first clock rising edge during reset pulse... can anyone suggest why this happens?
Title: Re: Simple CPLD project- need some basic help!
Post by: ian on April 11, 2011, 09:53:19 am
That's really strange. I looked through the schematic and simulation, and did my best to read the test bench, it all looks correct to me. Shouldn't STOP_S1B also go low?
Title: oops, nevermind- found it!
Post by: jbeale on April 11, 2011, 12:06:30 pm
Ok, the two input flip-flops are clocked only by the two input signals (stop & start), not the CLK line. So they never see the reset pulse, since they aren't clocked at that time. So I want to use a jam-reset type FF for those first two FFs, not synchronous type as I have now.

Realized it just as I went to bed- I need more sleep...
----
Edit: to be more precise, the FF I used was: FDR  "Macro: D Flip-Flop with Synchronous Reset"
but what I want is: FDC  “Macro: D Flip-Flop with Asynchronous Clear”

...from CPLD Libraries Guide version 13.1 (March 1 2011), p. 326 & 375: “cpld_all_scm.pdf”
http://www.xilinx.com/support/documenta ... ll_scm.pdf (http://www.xilinx.com/support/documentation/sw_manuals/xilinx13_1/cpld_all_scm.pdf)
Title: Re: Simple CPLD project- need some basic help!
Post by: ian on April 11, 2011, 12:19:01 pm
Ah, I thought the FFs reset independently of the clock. That makes sense then, thanks for the update.

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.00892047336session_write_close ( )...(null):0
20.00922178912ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.00922179688Database_MySQL->query( ).../DatabaseHandler.php:119
40.05422318408Database_MySQL->error( ).../Db-mysql.class.php:273