module out_ct title ' output control 5 juillet 96 modified 3/10/96 ' out_ct device ; "INPUT clock pin ; init,tmod pin; pushvme pin; "to push data from vme to out push pin; "from useq to push data from glue to out hold_in pin; "hold from output hold_out pin istype 'reg'; "hold to useq clear node; "clear all on init or after EE "DATA input from glue gluedv_ pin; "data strobe from glue groad0,groad1,groad2,groad3,groad4,groad5 pin; groad6,groad7,groad8,groad9,groad10,groad11 pin; groad12,groad13,groad14,groad15,groad16 pin; groad17,groad18,groad19,groad20 pin; "node road memory to have always the last road present at the out road0,road1,road2,road3,road4,road5 pin istype 'reg'; road6,road7,road8,road9,road10,road11 pin istype 'reg'; road12,road13,road14,road15,road16 pin istype 'reg'; road17,road18,road19,road20 pin istype 'reg'; "EE word from input in_epout pin;"to choose EP bit in out word ee_out pin; " to control when to output the EEword ee_d_in0,ee_d_in1,ee_d_in2,ee_d_in3 pin; ee_d_in4,ee_d_in5,ee_d_in6,ee_d_in7 pin; ee_d_in9,ee_d_in10,ee_d_in11,ee_d_in12 pin; ee_d_in13,ee_d_in14,ee_d_in15,ee_d_in16 pin; ee_d_in17,ee_d_in18,ee_d_in19,ee_d_in20 pin; "vme databus ivdata0,ivdata1,ivdata2,ivdata3,ivdata4,ivdata5 pin; ivdata6,ivdata7,ivdata8,ivdata9,ivdata10,ivdata11 pin; ivdata12,ivdata13,ivdata14,ivdata15,ivdata16 pin; ivdata17,ivdata18,ivdata19,ivdata20 pin; ivdata21,ivdata22 pin; "vme control input vme_toom,vme_hold pin; " vme add to useq during tmod maxroadr,maxroadw pin; "vme control to read and write vmeholdr,vmephir pin; "read hold or sector from vme vmeoe pin; "oe for reading registers "COUNTING OF ROADS "maxroad= memory for ivdata "croad= counter for roads "encount enable counter when new road, stops when max reached "toomuch=1 when counter=max "toomuch1=toomuch registered, cleared with init or after EEword is sent "truncout= (old EEbit14) OR (toomany) "toomany=output for useq: toomuch1 if !tmod or vme address if tmod maxroad0,maxroad1,maxroad2 pin istype 'reg,buffer'; maxroad3,maxroad4,maxroad5 pin istype 'reg,buffer'; croad5,croad4,croad3 pin istype 'reg,xor'; croad2,croad1,croad0 pin istype 'reg,xor'; encount node; toomuch node; toomuch1 pin istype 'reg,buffer'; truncout node; toomany pin istype 'reg,buffer'; " PARITY glpar pin istype 'reg,xor'; "final parity ipar1,ipar2,ipar3,ipar4 pin istype 'reg'; "1er stage for parity ipar5,ipar6,ipar7,ipar8 pin istype 'reg'; parr1,parr2 pin istype 'reg,xor'; "2nd stage for parity push1,pushg pin istype 'reg,buffer';"delay push for parity finee pin istype'reg'; "reset glpar after EEword sent "OUTPUT datas: 2 identique buses and enoutds_ for output and spy "enable is one as long as there is (push # pushvme # ee_out) road_out0,road_out1,road_out2,road_out3 pin istype'reg,buffer'; road_out4,road_out5,road_out6,road_out7 pin istype'reg,buffer'; road_out8,road_out9,road_out10 pin istype'reg,buffer'; road_out11,road_out12,road_out13 pin istype'reg,buffer'; road_out14,road_out15,road_out16 pin istype'reg,buffer'; road_out17,road_out18,road_out19 pin istype'reg,buffer'; road_out20,road_out21,road_out22 pin istype'reg,buffer'; road_spy0,road_spy1,road_spy2,road_spy3 pin istype'reg,buffer'; road_spy4,road_spy5,road_spy6,road_spy7 pin istype'reg,buffer'; road_spy8,road_spy9,road_spy10 pin istype'reg,buffer'; road_spy11,road_spy12,road_spy13 pin istype'reg,buffer'; road_spy14,road_spy15,road_spy16 pin istype'reg,buffer'; road_spy17,road_spy18,road_spy19 pin istype'reg,buffer'; road_spy20,road_spy21,road_spy22 pin istype'reg,buffer'; enoutds_,enospds_ pin istype 'reg'; "out for testing spare1,spare2 pin; H,L,X,Z,C,P = 1,0,.X.,.Z.,.C.,.P.; groad =[groad20..groad0]; road =[road20..road0]; ivdata =[ivdata22..ivdata0]; road_out =[road_out22..road_out0]; road_outl=[road_out20..road_out0]; road_spy =[road_spy22..road_spy0]; road_spyl=[road_spy20..road_spy0]; dat_ee =[1,in_epout, ee_d_in20..ee_d_in15, truncout, ee_d_in13..ee_d_in9, glpar, ee_d_in7..ee_d_in0]; ipar =[ipar8..ipar1,parr1,parr2,push1,pushg,glpar]; croad =[croad5..croad0]; maxdata =[ivdata5..ivdata0]; maxroad =[maxroad5..maxroad0]; phi =[groad20..groad17]; "read of phi sector phidata =[ivdata3..ivdata0]; ivdata50 =ivdata[5..0]; "read of misc data xor_factors croad :=croad; "to force using xor for counting equations " ROAD MEMORY road.clk = clock; road.ar = clear; road := (groad & !gluedv_) # (road & gluedv_); "OUT ROAD " multiplex of road( push ), eeword( ee_out ) and vmedata (pushvme) " groad=glue road, road=groad_reg "idem for spy but another output road_out.clk= clock; road_out.ar =init; road_outl := ( road & push ); " 20 bits from glue road_out21 := ( in_epout & push ); road_out22 := ( (0) & push ); " 0 when not EEword road_out := ( ivdata & pushvme ); " from vme road_out := ( dat_ee & ee_out ); " when ee_out from useq road_out := ( road_out & !(push # pushvme # ee_out) );"last word road_spy.clk= clock; road_spy.ar =init; road_spyl := ( road & push ); " 20 bits from glue road_spy21 := ( in_epout & push ); road_spy22 := ( (0) & push ); " 0 when not EEword road_spy := ( ivdata & pushvme ); " from vme road_spy := ( dat_ee & ee_out ); " when ee_out from useq road_spy := ( road_spy & !(push # pushvme # ee_out) );"last word "enable for write clock +clock with delay enoutds_ := !( pushvme # push # ee_out) ; enoutds_.clk= clock; enospds_ := !( pushvme # push # ee_out) ; enospds_.clk= clock; "Clear glpar after ee_out finee := ee_out; finee.clk = clock; clear = init # finee; "parity ipar.ar =clear; ipar.clk =clock; ipar1 := road0 $ road1 $ road2; "1rst stage memory ipar2 := road3 $ road4 $ road5; ipar3 := road6 $ road7 $ road8; ipar4 := road9 $ road10 $ road11; ipar5 := road12 $ road13 $ road14; ipar6 := road15 $ road16 $ road17; ipar7 := road18 $ road19 $ road20; ipar8 := in_epout; parr1 := ipar1 $ ipar2 $ ipar3 $ ipar4 ; "2nd stage memory parr2 := ipar5 $ ipar6 $ ipar7 $ ipar8 ; push1 := push; " push delayed pushg := push1; "global parity memory: new calculation when new road glpar := ( pushg & ( parr1 $ parr2 $ glpar)) # (!(pushg) & glpar ); "miscellaneous vme read vmeoe = maxroadr # vmeholdr # vmephir; ivdata50.oe= vmeoe; "maxroad from vme & to vme maxdata = maxroad & maxroadr; maxroad:= ( maxdata & maxroadw ) # ( maxroad & !maxroadw); maxroad.clk=clock; "stop counting when max is reached encount = push & !toomuch; " croad :=((croad+1) & encount) # (croad & !encount); croad.clk= clock; croad.ar = clear; toomuch = (croad==maxroad); toomuch1 := ( toomuch ); toomuch1.clk = clock; toomuch1.ar = clear; toomany := (toomuch1 & !tmod) # (vme_toom & tmod); toomany.clk = clock; toomany.ar = clear; truncout = toomuch # ee_d_in14; "HOLD hold_out.clk =clock; hold_out := ( hold_in & !tmod ) # ( vme_hold & tmod ); "vme read of hold ivdata0 = hold_in & vmeholdr; "vme read of phi phidata = phi & vmephir; "test output spare1 = toomuch; spare2 = toomuch1; end