Documente Academic
Documente Profesional
Documente Cultură
it is triggered by one or more sensor or inputs.In addition there will be a master switch to turn on or off the system. Let us suppose that there is 1>Car door switch D. 2>Vibration Detector switch V and 3> Master Switch M We will use the convention that when the door is opened D=1,otherwise D=0.Similarly,when the car is being shaken,V=1,but this only the system is turned on, that is M=1.When M=0 as in when we are entering the car or when we are driving ,we dont want the siren to come on
Design Code
module Security( input M_Master,//When the System is ON input D_Door, input V_Vibration, output S_Siren );
Testbench Code
module Security_TB; // Inputs reg M_Master; reg D_Door; reg V_Vibration; // Outputs wire S_Siren; // Instantiate the Unit Under Test (UUT) Security uut ( .M_Master(M_Master), .D_Door(D_Door), .V_Vibration(V_Vibration), .S_Siren(S_Siren) );
M_Master = 1; D_Door = 0; V_Vibration = 1; #100; M_Master = 1; D_Door = 1; V_Vibration = 0; #100; M_Master = 1; D_Door = 1; V_Vibration = 1; #800; M_Master = 0; D_Door = 1; V_Vibration = 1; #100;
end endmodule