//----- Synthesizable Circuit -----
module MathLock (
// "MathLock" reference design; top-level module
//
// ECE333: Digital Systems (W2002-03)
// Dr. Ed Doering
//
// Inputs:
iG$Oscillator, // Master clock oscillator
iG$PowerOnReset, // Power-on reset (active high)
iD$Keypad, // Numerical keypad, 0 to 9
// Outputs:
oE$ActivatePassLED, // Pass LED
oE$ActivateFailLED, // Fail LED
oE$OpenLock // Open the solenoid lock
);
// Port mode declarations:
// Inputs:
input iG$Oscillator;
input iG$PowerOnReset;
input [9:0] iD$Keypad;
// Outputs:
output oE$ActivatePassLED;
output oE$ActivateFailLED;
output oE$OpenLock;
// Registered identifiers:
reg [9:0] r$Keypad_SYNC;
// Wires to interconnect modules
wire wC$InitializeTimer;
wire wC$EnableTimer;
wire wC$AddKey;
wire wC$ClearSum;
wire wS$KeyIsPressed;
wire wS$IntervalIsComplete;
wire wS$SumIsCorrect;
wire wS$KeyPressingIsFinished;
wire [3:0] wD$KeyValue;
// Use synchronizers on all asynchronous inputs
always @ (posedge iG$Oscillator or posedge iG$PowerOnReset)
if (iG$PowerOnReset)
r$Keypad_SYNC <= 0;
else
r$Keypad_SYNC <= iD$Keypad;
// Instantiate the system controller:
Controller Controller (
.iG$MasterClock (iG$Oscillator),
.iG$MasterReset (iG$PowerOnReset),
.iS$KeyIsPressed (wS$KeyIsPressed),
.iS$IntervalIsComplete (wS$IntervalIsComplete),
.iS$SumIsCorrect (wS$SumIsCorrect),
.iS$KeyPressingIsFinished (wS$KeyPressingIsFinished),
.oC$InitializeTimer (wC$InitializeTimer),
.oC$EnableTimer (wC$EnableTimer),
.oC$AddKey (wC$AddKey),
.oC$ClearSum (wC$ClearSum),
.oE$ActivatePassLED (oE$ActivatePassLED),
.oE$ActivateFailLED (oE$ActivateFailLED),
.oE$ActivateSolenoid (oE$OpenLock)
);
// Instantiate the datapath devices
KeyPadEncoder KeyPadEncoder (
.iD$KeyPad ( r$Keypad_SYNC ),
.oS$KeyIsPressed ( wS$KeyIsPressed ),
.oD$KeyValue ( wD$KeyValue )
);
KeySummer KeySummer (
.iG$MasterClock (iG$Oscillator),
.iG$MasterReset (iG$PowerOnReset),
.iD$KeyValue (wD$KeyValue),
.iC$AddKey (wC$AddKey),
.iC$ClearSum (wC$ClearSum),
.oD$KeySum ( ),
.oD$KeysPressed ( ),
.oS$SumIsCorrect (wS$SumIsCorrect),
.oS$KeyPressingIsFinished (wS$KeyPressingIsFinished)
);
IntervalTimer IntervalTimer (
.iG$MasterClock (iG$Oscillator),
.iG$MasterReset (iG$PowerOnReset),
.iC$InitializeTimer (wC$InitializeTimer),
.iC$EnableTimer (wC$EnableTimer),
.oS$IntervalIsComplete (wS$IntervalIsComplete),
.oD$IntervalTimer ( )
);
endmodule
This page: |
Created: | Thu Jan 16 14:38:01 2003 |
|
From: |
mathlock.v |