module
IntervalTimer
// Measures fixed time interval to activate solenoid and LEDs.
(
// Clock and reset:
iG$MasterClock, // Master clock
iG$MasterReset, // Master reset (active high)
// Control point signals from controller:
iC$InitializeTimer, // Set timer to beginning of interval
iC$EnableTimer, // Allow timer to operate
// Condition signals to controller:
oS$IntervalIsComplete, // Indicates end of time interval
// Data outputs:
oD$IntervalTimer // Value of interval timer
);
parameter p$TimeInterval = 20; // Number of clock periods (assumes
// 10-Hz master clock.
input iG$MasterClock;
input iG$MasterReset;
input iC$InitializeTimer;
input iC$EnableTimer;
output oS$IntervalIsComplete;
output [4:0] oD$IntervalTimer;
reg [4:0] oD$IntervalTimer;
always @ (posedge iG$MasterClock or posedge iG$MasterReset)
if (iG$MasterReset)
oD$IntervalTimer <= p$TimeInterval-1;
else
if (iC$InitializeTimer)
oD$IntervalTimer <= p$TimeInterval-1;
else if (iC$EnableTimer)
oD$IntervalTimer <= oD$IntervalTimer - 1;
assign oS$IntervalIsComplete = (oD$IntervalTimer == 0);
endmodule
This page: |
Created: | Thu Jan 16 14:38:01 2003 |
|
From: |
intervaltimer.v |