Prev: CFP: SAS'2010 - 17th International Static Analysis Symposium, Perpignan, France
Next: Get 101 Question on C, C++, C++ under Windows, MFC, DLL, COM/DOM
From: Thad Smith on 15 Mar 2010 00:23 Thad Smith wrote: > Moi wrote: >> On Fri, 12 Feb 2010 21:49:21 -0700, Thad Smith wrote: >> * State table. * "trusted" bits are shown as 0 and 1; >> * "suspect" bits as . and ?; >> * -a / +a := clear / set bit 'a' >> * ... :+ continue with the normal state path. >> * >> * dcba dcba [ ... recovery path ... ] >> * 0011 ..11 [Off] -c .011 -d 0011 >> * 0111 0?1? -a 0?10 -c 0010 +c 0110 ... >> * 0110 .11. -a .110 -d 0110 ... >> * 1110 ?1?0 -d 01?0 -b 0100 +b 0110 ... >> * 1100 11.. [On] -a 11.0 -b 1100 >> * 1101 1?0? -a 1?00 -c 1000 +a 1001 ... >> * 1001 1..1 -b 1.01 -c 1001 ... >> * 1011 ?0?1 -b ?001 -d 0001 +b 0011 >> */ > > What is the recovery path for 0000, the initial state? It would be best to specify the recovery path for all possible startup states. How about startup in 0, 1, 2, 4, 5, 8, a, f, interpreting bit combination as hexadecimal? I assume that resting states are 3, 6, c, 9, where 3, 6 are global off, while c and 9 are global on. Is this correct? -- Thad
From: Moi on 15 Mar 2010 18:39 On Sun, 14 Mar 2010 21:23:38 -0700, Thad Smith wrote: > Thad Smith wrote: >> Moi wrote: >> What is the recovery path for 0000, the initial state? > > It would be best to specify the recovery path for all possible startup > states. How about startup in 0, 1, 2, 4, 5, 8, a, f, interpreting bit > combination as hexadecimal? > > I assume that resting states are 3, 6, c, 9, where 3, 6 are global off, > while c and 9 are global on. Is this correct? It is in the code. The comment at the top of the file only describes the normal flow of state. **********/ int restart(void) { unsigned state; while (1) { state = getbits(); fprintf(stderr, "Restart state = %s Rawbits=%02x %02x %02x %02x\n" , states[state] , bits[3], bits[2], bits[1], bits[0] ); switch (state) { case COMBINE4(0,0,0,0): /* before initialization */ bit_clr(2); bit_clr(1); bit_clr(0); bit_set(0); bit_set(1); bit_clr(3); return getstate(); case COMBINE4(0,0,1,1):/* ..11 [Off] */ /************* et cetera. AvK
From: Thad Smith on 16 Mar 2010 00:05
Moi wrote: > On Sun, 14 Mar 2010 21:23:38 -0700, Thad Smith wrote: > >> Thad Smith wrote: >>> Moi wrote: > >>> What is the recovery path for 0000, the initial state? >> It would be best to specify the recovery path for all possible startup >> states. How about startup in 0, 1, 2, 4, 5, 8, a, f, interpreting bit >> combination as hexadecimal? >> >> I assume that resting states are 3, 6, c, 9, where 3, 6 are global off, >> while c and 9 are global on. Is this correct? > > It is in the code. The comment at the top of the > file only describes the normal flow of state. > > **********/ > > int restart(void) > { > unsigned state; > > while (1) { > state = getbits(); > fprintf(stderr, "Restart state = %s Rawbits=%02x %02x %02x %02x\n" > , states[state] > , bits[3], bits[2], bits[1], bits[0] ); > switch (state) { > case COMBINE4(0,0,0,0): /* before initialization */ > bit_clr(2); > bit_clr(1); > bit_clr(0); > bit_set(0); > bit_set(1); > bit_clr(3); > return getstate(); > case COMBINE4(0,0,1,1):/* ..11 [Off] */ > > /************* > > et cetera. Since Francois hasn't posted in a while, I'll do the analysis. The initial state, before the program runs is 0000. Run the initialization for that state and interrupt during bit_set(1), producing 00?1. On subsequent powerup, bits 2 and 3 are erased, not changing the state and resting at 00?1. It can be read as either global state 0 or global state -1 without intervening toggle. -- Thad |