Datasets:
Download verification/check_gate.c from PureOne/ChronoSheaf-Input-Lag: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/datasets/PureOne/ChronoSheaf-Input-Lag/resolve/main/verification/check_gate.c
- Command line
-
hf download hf://datasets/PureOne/ChronoSheaf-Input-Lag/verification/check_gate.c
-
curl -L -o check_gate.c https://huggingface.co/datasets/PureOne/ChronoSheaf-Input-Lag/resolve/main/verification/check_gate.c
1.5 kB
| enum plant { LOCKED, FIXED_COST, IMMEDIATE, DECOUPLED }; | |
| static void run(enum plant type) { | |
| xr_gate g={0}; int64_t shift=0,end=100000; | |
| unsigned active=0,tests=0; | |
| for(unsigned i=0;i<120;++i) { | |
| int64_t start=end+shift+2400; | |
| int64_t next= type==LOCKED || type==DECOUPLED ? end+10000 : | |
| type==FIXED_COST ? start+7600 : start+20; | |
| int64_t requested=xr_after(&g,start,next,shift); | |
| if(g.mode==XR_PROBE && requested) ++tests; | |
| if(g.mode==XR_ACTIVE && requested) ++active; | |
| shift=requested; end=next; | |
| } | |
| if(type==IMMEDIATE) assert(active==0 && tests==0); | |
| if(type==FIXED_COST) assert(active==0 && tests>0); | |
| if(type==LOCKED || type==DECOUPLED) assert(active>60); | |
| printf("plant=%d probe_waits=%u active_waits=%u\n",type,tests,active); | |
| } | |
| int main(void) { | |
| for(int i=0;i<4;i++) run((enum plant)i); | |
| xr_gate g={0}; int64_t t=100000,d=0; | |
| for(unsigned i=0;i<70;i++) {int64_t b=t+d+2000;t+=10000;d=xr_after(&g,b,t,d);} | |
| assert(g.mode==XR_ACTIVE&&d>0); | |
| int64_t b=t+d+300;t+=d+500; d=xr_after(&g,b,t,d); | |
| assert(d==0 && g.mode==XR_ACTIVE); | |
| b=t+2000;t+=10000;d=xr_after(&g,b,t,0);assert(d>0); | |
| b=t+d+2000;t+=40000;d=xr_after(&g,b,t,d);assert(!d&&g.mode==XR_COOLDOWN); | |
| assert(!xr_after(&g,t-1,t-2,0)&&g.mode==XR_OBSERVE); | |
| puts("Early return, long stall, changed clock and serial/decoupled indistinguishability passed."); | |
| } | |