Download Pulsonix Spice Device Reference Manual
Transcript
Digital Simulation 93 This says "If the count equals 199 set to zero otherwise increment by one". As before, this will happen on each clock edge. Add an Asynchronous Reset The logic definition language supports the addition of asynchronous controls to synchronous registers. Here we will add an asynchronous reset. The complete definition becomes: P O R T P O R T ( E D G E C o u n t C o u n t C o u n t ( D E : u E L L A Y = = O D ! C o t A = Y 5 = n 1 , W R e s e t u n t = = 1 c o u n t = 0 n I ) D ? T H = 0 9 C o u n t R e s e t 8 , C O L u O t C K = i o u i n n [ 0 t [ [ ] 1 0 : ] 7 ] ; ; ) C o u n t ; ; 9 ? 0 : C o u n t + 1 ; ; To add the reset signal we have to add two lines to the definition. The first: P O R T R e s e t i n [ 1 ] ; defines the signal pin to be used for the reset and the second: C o u n t : = ! R e s e t ? 0 ; defines the action to be taken. This is an asynchronous action statement. The '!' means NOT so the line says "If Reset is NOT TRUE (i.e. low) set the count to zero otherwise do nothing. Asynchronous action statements are always of the form: register_name := condition ? action ; The ':' signifies that the statement is asynchronous and that the action should happen immediately. Example 2 - A Simple Multiplier P O R T P O R P O R M u l t ( M u l T i n T i n O u D t E L = A Y i = n 1 1 0 * n i ) n 2 t O u t o 1 i n [ 0 2 i n [ 4 u t [ 0 : : 3 ] ; : 7 ] ; 7 ] ; ; The above defines a simple combinational circuit, that of a 4X4 digital multiplier. The inputs in1 and in2 are treated as 4 bit unsigned values so if both are zero the output will be zero and if both are 1111 (i.e. 15) the result will be 11100001 (i.e. 225). See the circuit EXAMPLES\ALB_Examples\Mult.sch.