home *** CD-ROM | disk | FTP | other *** search
- ;---------------------------------------------------------
- ; Now we'll use the combinational incrementer module to
- ; build a resetable counter.
- ;---------------------------------------------------------
- CHIP cntr NFX780_84
-
- PIN 47 clock ;* the clock for the entire circuit
- PIN 48 reset ;* resets the counter to 0
- PIN cnt[0:2] ;* the output of the counter
- PIN nxt[0:2] ;* the next state of the counter
- PIN [34:37] s[0:3] ;* LED segment drivers
- PIN [39:41] s[4:6] ;* LED segment drivers
-
- MODULE incrmntr( rst=reset, cur[0:2]=cnt[0:2],
- nxt[0:2]=nxt[0:2] )
- MODULE leddigit( d[0:2]=cnt[0:2], d3=GND, s[0:6]=s[0:6] )
-
- EQUATIONS
- cnt[0:2] := nxt[0:2] ;* next state becomes
- cnt[0:2].ACLK = clock ;* curr. state on pos. clk
-
- SIMULATION
- VECTOR cnt := [cnt2,cnt1,cnt0]
- TRACE_ON clock cnt
- SETF /clock ;* set the clock low to start
- SETF reset ;* activate the reset input
- CLOCKF clock ;* clock the counter to reset it
- SETF /reset ;* deactivate the reset
- for i:=0 TO 20 DO
- BEGIN
- CLOCKF clock
- END
-