[CSCI2321] set/reset latch
John Howland
jhowland at ariel.cs.trinity.edu
Mon Mar 28 14:05:35 CST 2005
The definition of set_reset which appears in log20050328
has a flaw. What is the flaw? Hint: try inputs of
0 1 (set) for both state values and inputs of
1 0 (reset) for both state values.
The following definitions (set-reset.ijs) and
(set-reset1.ijs) seem to fix the problem, but why?
Following are the definitions:
leda:/users/jhowland/cs2321 jhowland$ cat set-reset.ijs
NB. a set-reset state object
state =: 0 NB. Initially the state is zero
not_state =: 1
require_circuits_ 'circuits.ijs'
bitNor =: bitNot_circuits_ & bitOr_circuits_
set_reset =: monad define
'r s' =. y.
'state not_state' =: (bitNor r , not_state) , bitNor state , s
'state not_state' =: (bitNor r , not_state) , bitNor state , s
)
leda:/users/jhowland/cs2321 jhowland$ cat set-reset1.ijs
NB. a set-reset state object
state =: 0 NB. Initially the state is zero
not_state =: 1
require_circuits_ 'circuits.ijs'
bitNor =: bitNot_circuits_ & bitOr_circuits_
set_reset =: monad define
'r s' =. y.
(state =: bitNor r , not_state) , not_state =: bitNor state , s
state , not_state =: bitNot_circuits_ state
)
--
_______________________________________________________________
John E. Howland url: http://www.cs.trinity.edu/~jhowland/
Computer Science email: jhowland at ariel.cs.trinity.edu
Trinity University voice: (210) 999-7364
One Trinity Place fax: (210) 999-7477
San Antonio, Texas 78212-7200
More information about the CSCI2321
mailing list