From: <jo...@us...> - 2009-10-27 13:48:55
|
Revision: 641 http://mspsim.svn.sourceforge.net/mspsim/?rev=641&view=rev Author: joxe Date: 2009-10-27 13:48:47 +0000 (Tue, 27 Oct 2009) Log Message: ----------- fixed bug that caused division by zero when updating TCCTL and calculating CC_I Modified Paths: -------------- mspsim/se/sics/mspsim/core/Timer.java Modified: mspsim/se/sics/mspsim/core/Timer.java =================================================================== --- mspsim/se/sics/mspsim/core/Timer.java 2009-10-27 09:55:05 UTC (rev 640) +++ mspsim/se/sics/mspsim/core/Timer.java 2009-10-27 13:48:47 UTC (rev 641) @@ -365,7 +365,11 @@ /* needs the TimerA clock speed here... */ int aTicks = clockSpeed / core.aclkFrq; updateCounter(cycles); - if (counter % aTicks > aTicks / 2) { + + /* only calculate this if clock runs faster then ACLK - otherwise it + * this will be dividing by zero... + */ + if (aTicks > 0 && counter % aTicks > aTicks / 2) { input = true; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |