"================================================================================================ #TITLE 'ZEUS MVD C&C MASTER, PLD4: Clock Synchronisation'; #ENGINEER 'Martin Postranecky / Dominic A Hayes'; #COMPANY 'University College London'; #COMMENT ''; "================================================================================================ " MODS "------ "04feb00 gated reset of q3/4 in pld-4/6 "10feb00 clrtestbusy converted to pulse before reset of q1 (testbusy) in pld-4/7. "16feb00 AND gflt removed from a_accept & trig_in equations in 4/8. "17feb00 ttyp inputs changed to ttypout_s24 (using spare inputs from pld2). " abortout removed from RESET signal of q1 in pld-4/7. "25feb00 local_mode added to busyout eqn in pld-4/4. " changes to lasttrig_abort (incl q2 removed) in pld-4/14. " rosys -> rosysout_s34 in pld-4/8 (using spare outputs from pld2 and 3). "28feb00 local_mode removed from OR gate into new OR gate in pld-4/4. " includes new m_busy output feeding s34[1]. " busyout -> m_busy in pld4/5. " extra NAND gate input to /clr of AND gate in pld4/12. "29feb00 new acceptout1 from 4/11. acceptout -> acceptout1 in 4/8. " "----------------------------------------------------------------------- FUNCTION level_to_pulse "Converts input level into a single pulse approx 2tPD long. (INPUT level, reset); NODE pulse CLOCKED_BY level RESET_BY clr NO_REDUCE; NODE clr; RETURN pulse; clr = pulse + /reset; pulse = 1; END level_to_pulse; "----------------------------------------------------------------------- "------------------------------------------------------------------------------------------------ "modified to pld4 25/5/99 PROCEDURE f_err_and_busy "PLD-4/1 " "Called by Main body (INPUT mf_error, vf_error, mbusy, vbusy, nclk_4, noa_rst; OUTPUT f_errorout, busy_1, nbusy_1); NODE q1, q2, q3, q4 CLOCKED_BY nclk_4 RESET_BY /noa_rst; q1 = mf_error OR vf_error; q2 = q1; f_errorout = q2; q3 = mbusy OR vbusy; q4 = q3; busy_1 = q4; nbusy_1 = /q4; END f_err_and_busy; "------------------------------------------------------------------------------------------------ "------------------------------------------------------------------------------------------------ "modified to pld4 25/5/99 PROCEDURE cal_and_oa_rst "PLD-4/2 " "Called by Main body (INPUT s_rst, vmoa_reset, vcalibrate, nclk_5, clk_6, noa_rst; OUTPUT cal_h, oa_reset, noa_reset); NODE q1 CLOCKED_BY (s_rst OR vmoa_reset) RESET_BY /u; NODE q2 CLOCKED_BY nclk_5 RESET_BY /u; NODE q3 CLOCKED_BY nclk_5; NODE u, v; NODE q4 CLOCKED_BY vcalibrate RESET_BY /v; NODE q5 CLOCKED_BY clk_6 RESET_BY /v; NODE q6 CLOCKED_BY clk_6 RESET_BY /noa_rst; u = noa_reset AND noa_rst; v = /q6 AND noa_rst; q1 = 1; q2 = q1; q3 = q2; q4 = 1; q5 = q4; q6 = q5; oa_reset = q3; noa_reset = /q3; cal_h = q6; END cal_and_oa_rst; "------------------------------------------------------------------------------------------------ "------------------------------------------------------------------------------------------------ "modified to pld4 25/5/99 PROCEDURE cal_trig_delay "PLD-4/3 " "Called by Main body (INPUT cal_h, ntrig_a, cctdl[5..0], clk_6, noa_rst; OUTPUT cal_trig, cal_busy, ncal_busy); NODE x; NODE count_eq_cctdl DEFAULT_TO 0; NODE q1 CLOCKED_BY cal_h RESET_BY /x; NODE count [6] CLOCKED_BY clk_6 CLOCK_ENABLED_BY q1 RESET_BY /x; x = ntrig_a AND noa_rst; count = count .+. 1; IF (count = cctdl) THEN count_eq_cctdl = 1; END IF; cal_trig = count_eq_cctdl AND cal_busy; q1 = 1; cal_busy = q1; ncal_busy = /q1; END cal_trig_delay; "------------------------------------------------------------------------------------------------ "------------------------------------------------------------------------------------------------ "modified to pld4 25/5/99 PROCEDURE not_reset "PLD-4/4 " "Called by Main body (INPUT busy_1, cal_busy, int_busy, testbusy, errorout, acceptclk[3..1], nenoa_rst, vh_reset, nclk_4, nclk_5, noa_rst, init_reset, local_mode; OUTPUT h_reset, not_reset, busyout, m_busy_s34); NODE q1 CLOCKED_BY acceptclk[3] RESET_BY /w; NODE q2 CLOCKED_BY nclk_4 RESET_BY /noa_rst; NODE q3 CLOCKED_BY /errorout RESET_BY /w; NODE q4 CLOCKED_BY nclk_5 RESET_BY /w; NODE q5 CLOCKED_BY nclk_5 RESET_BY /noa_rst; NODE q6 CLOCKED_BY nclk_5 RESET_BY /noa_rst; NODE q7 CLOCKED_BY nclk_5 RESET_BY /noa_rst; NODE w; w = /q5 AND noa_rst; not_reset = (nenoa_rst OR noa_rst) AND /q5 AND /q7; h_reset = /not_reset; q1 = errorout; q2 = q1; q3 = 1; q4 = q3; q5 = q4; q6 = vh_reset OR init_reset; q7 = q6; m_busy_s34 = testbusy OR int_busy OR busy_1 OR cal_busy OR q2; busyout = m_busy_s34 OR local_mode; END not_reset; "------------------------------------------------------------------------------------------------ "------------------------------------------------------------------------------------------------ "Modified to pld4 25/5/99 PROCEDURE triggers "PLD-4/5 " "Called by Main body (INPUT envar_trig, ncal_busy, m_busy_s34, s_trig, ext_trig, vtrigger, cal_trig, nclk_4, nclk_5, noa_rst; OUTPUT trig_a, trig_h, ntrig_a); NODE y, z; NODE count_finished DEFAULT_TO 0; NODE q0 CLOCKED_BY (z OR cal_trig) RESET_BY /y; NODE q1 CLOCKED_BY nclk_5 RESET_BY /y; NODE q2 CLOCKED_BY nclk_5 RESET_BY /noa_rst; NODE q3h CLOCKED_BY nclk_5 RESET_BY /noa_rst; NODE q4h CLOCKED_BY nclk_5 RESET_BY /noa_rst; NODE q5h CLOCKED_BY nclk_5 RESET_BY /noa_rst; NODE q3a CLOCKED_BY nclk_4 RESET_BY /noa_rst; NODE q5a CLOCKED_BY nclk_4 RESET_BY /noa_rst; NODE count[8] CLOCKED_BY nclk_4 CLOCK_ENABLED_BY q5a RESET_BY /q0; y = noa_rst AND /count_finished; z = ncal_busy AND /(m_busy_s34 AND ntrig_a) AND (s_trig OR ext_trig OR vtrigger); q0 = /(ncal_busy AND envar_trig AND /q0); q1 = (envar_trig AND z AND /q0) OR q0; q2 = q1; q3h = q2; q4h = q3h; q5h = q3h AND /q4h; q5a = q3a; q3a = q2; count = count .+. 1; IF (count = 103) THEN count_finished = 1; END IF; trig_h = q5h; trig_a = q5a; ntrig_a = /q5a; END triggers; "------------------------------------------------------------------------------------------------ "------------------------------------------------------------------------------------------------ "new 25/5/99 (modified f_error_and_busy) PROCEDURE error_and_a_reset "PLD-4/6 " "Called by Main body (INPUT merror, verror, va_reset, not_reset, nenh_a_reset, nclk_4, noa_rst, vt_error, ext_error, next_error; OUTPUT errorout, a_reset, na_reset, t_errorout, nerrorout); NODE q1, q2, q5, q6 CLOCKED_BY nclk_4 RESET_BY /noa_rst; NODE q3, q4 CLOCKED_BY nclk_4 RESET_BY /q34reset; NODE q34reset; q34reset = noa_rst OR /(not_reset OR nenh_a_reset); q1 = merror OR verror; q2 = q1; errorout = q2; nerrorout = /q2; q3 = va_reset OR /(not_reset OR nenh_a_reset); q4 = q3; a_reset = q4; na_reset = /q4; q5 = vt_error OR ext_error OR /next_error; q6 = q5; t_errorout = q6; END error_and_a_reset; "------------------------------------------------------------------------------------------------ "------------------------------------------------------------------------------------------------ "new 25/5/99 PROCEDURE busys "PLD-4/7 " "Called by Main body (INPUT acceptclk[3..1], noa_rst, entestbusy, abortout, clrtestbusy, nclk_4; OUTPUT int_busy, testbusy); NODE busy_count[4] CLOCKED_BY nclk_4 CLOCK_ENABLED_BY q2 RESET_BY q2_reset; NODE count15 DEFAULT_TO 0; NODE q1 CLOCKED_BY acceptclk[3] RESET_BY /q1_reset; NODE q2 CLOCKED_BY acceptclk[3] RESET_BY q2_reset; NODE q1_reset, q2_reset; NODE ClrTestBusyPulse; "used to reset q1. ClrTestBusyPulse = level_to_pulse(clrtestbusy, noa_rst); q1 = 1; q1_reset = noa_rst AND entestbusy AND /ClrTestBusyPulse; testbusy = q1; q2 = 1; q2_reset = abortout OR /noa_rst OR count15; int_busy = q2; busy_count = busy_count .+. 1; IF (busy_count = 15) THEN count15 = 1; END IF; END busys; "------------------------------------------------------------------------------------------------ "------------------------------------------------------------------------------------------------ "new 25/5/99 PROCEDURE trigger_mpxers "PLD-4/8 " "Called by Main body (INPUT acceptout1, rosysout_s34[1..0], trig_h, nclk_5, trig_a, nclk_4, noa_rst, local_mode, gflt_mode, cal_h, testcal_h; OUTPUT a_accept, trig_in, initialise, fltaccept, fcstp); NODE q1, q2, q3 CLOCKED_BY nclk_5 RESET_BY /noa_rst; NODE q4, q5 CLOCKED_BY nclk_4 RESET_BY /noa_rst; fltaccept = acceptout1 AND /(rosysout_s34[1] AND rosysout_s34[0]); initialise = acceptout1 AND (rosysout_s34[1] AND rosysout_s34[0]); q1 = fltaccept; q2 = q1; q3 = q2; trig_in = (trig_h AND local_mode) OR (/q3 AND q2); "AND gflt removed. q4 = acceptout1; q5 = q4; a_accept = (trig_a AND local_mode) OR q5; "AND gflt removed. fcstp = cal_h OR testcal_h; END trigger_mpxers; "------------------------------------------------------------------------------------------------ "------------------------------------------------------------------------------------------------ "new 25/5/99 PROCEDURE slave_masking "PLD-4/9 " "Called by Main body (INPUT lbusy[5..1], lbusymask[5..1], lerror[5..1], lerrormask[5..1], lf_error[5..1], lf_errormask[5..1]; OUTPUT mbusy, merror, mf_error); mbusy = lbusy[1] AND lbusymask[1] OR lbusy[2] AND lbusymask[2] OR lbusy[3] AND lbusymask[3] OR lbusy[4] AND lbusymask[4] OR lbusy[5] AND lbusymask[5]; merror = lerror[1] AND lerrormask[1] OR lerror[2] AND lerrormask[2] OR lerror[3] AND lerrormask[3] OR lerror[4] AND lerrormask[4] OR lerror[5] AND lerrormask[5]; mf_error = lf_error[1] AND lf_errormask[1] OR lf_error[2] AND lf_errormask[2] OR lf_error[3] AND lf_errormask[3] OR lf_error[4] AND lf_errormask[4] OR lf_error[5] AND lf_errormask[5]; END slave_masking; "------------------------------------------------------------------------------------------------ "------------------------------------------------------------------------------------------------ "new 25/5/99 PROCEDURE test_pulse_and_delay "PLD-4/10 " "Called by Main body (INPUT testenclk1, ttypout_s24[2..0], seltt[2..0], noa_rst, clk_6, ctpdl[15..0]; OUTPUT testpulse_busy, ntestpulse_busy, testpulse, testcal_h); NODE tp, tcal_h DEFAULT_TO 0; NODE q1 CLOCKED_BY testpulse RESET_BY /q1_reset; NODE q1_reset; NODE q2 CLOCKED_BY clk_6 RESET_BY /noa_rst; NODE testpulse_count[16] CLOCKED_BY clk_6 CLOCK_ENABLED_BY q2 RESET_BY /q2; IF (ttypout_s24 = seltt) THEN tp = 1; END IF; testpulse = tp AND testenclk1; q1 = 1; q1_reset = noa_rst AND /testcal_h; q2 = q1; testpulse_busy = q2; ntestpulse_busy = /q2; testpulse_count = testpulse_count .+. 1; IF (testpulse_count = ctpdl) THEN tcal_h = 1; END IF; testcal_h = tcal_h AND testpulse_busy; END test_pulse_and_delay; "------------------------------------------------------------------------------------------------ "------------------------------------------------------------------------------------------------ "new 25/5/99 PROCEDURE clocks "PLD-4/11 " "Called by Main body (INPUT testenout, clk_1, acceptout, a_accept, nclk_4, trig_a, noa_rst, abortout; OUTPUT testenclk1, acceptclk[3..1], a_abort, acceptout1); NODE q1, q2 CLOCKED_BY clk_1 RESET_BY /noa_rst; NODE q3, q4, q5, q6 CLOCKED_BY nclk_4 RESET_BY /noa_rst; q1 = testenout; testenclk1 = /q1 AND testenout; q2 = acceptout; acceptclk[1] = /q2 AND acceptout; acceptout1 = q2; q3 = a_accept; acceptclk[3] = /q3 AND a_accept; q4 = trig_a; acceptclk[2] = /q4 AND trig_a; q5 = abortout; q6 = q5; a_abort = q6; END clocks; "------------------------------------------------------------------------------------------------ "------------------------------------------------------------------------------------------------ "new 25/5/99 PROCEDURE mode_init "PLD-4/12 " "Called by Main body (INPUT wrcontr1, noa_rst, initialise, bcn0gflt, neninitreset, h_reset, local_bcn0_s24; OUTPUT local_mode, gflt_mode, init_reset, ninit_reset); NODE q4 CLOCKED_BY initialise RESET_BY /q4_reset; NODE q4_reset; local_mode = wrcontr1; gflt_mode = /wrcontr1; q4 = 1; q4_reset = noa_rst AND /neninitreset AND /( bcn0gflt AND h_reset ) "NAND AND /( local_bcn0_s24 AND h_reset AND local_mode ); "NAND init_reset = q4; ninit_reset = /q4; END mode_init; "------------------------------------------------------------------------------------------------ "------------------------------------------------------------------------------------------------ "new 25/5/99 PROCEDURE select_lines "PLD-4/13 " "Called by Main body (INPUT noa_rst, a_accept, nclk_4; OUTPUT da[1..0]); NODE da_counter[1..0] CLOCKED_BY da_counter_clk RESET_BY /da_counter_reset; NODE da_counter_clk, da_counter_reset; da_counter_clk = a_accept AND (nclk_4 OR (da_counter[1] AND da_counter[0])); "= clken by a_accept da_counter_reset = noa_rst AND a_accept; da_counter = da_counter .+. 1; " da[0] da[1] " ------------ da[1..0] = da_counter[0..1]; "NB bit swap " 0 0 " 0 1 END select_lines; " 1 0 " 1 1 "------------------------------------------------------------------------------------------------ "------------------------------------------------------------------------------------------------ "new 25/5/99 PROCEDURE last_abort "PLD-4/14 " "Called by Main body (INPUT a_accept, abortout, noa_rst; OUTPUT lasttrig_abort); NODE q1 CLOCKED_BY abortout RESET_BY /q_reset; NODE q3 CLOCKED_BY a_accept RESET_BY /q_reset; NODE q_reset; q_reset = noa_rst AND /q3; q1 = a_accept; q3 = q1; lasttrig_abort = q1; END last_abort; "------------------------------------------------------------------------------------------------ "================================================================================================ " MAIN BODY "------------------------------------------------------------------------------------------------ " Signal Declarations " (INPUT/OUTPUT are chip I/O) "------------------------------------------------------------------------------------------------ INPUT envar_trig, s_trig, ext_trig, vtrigger, nclk_4, nclk_5, clk_6, noa_rst, s_rst, vmoa_reset, vcalibrate, cctdl[5..0], vf_error, vbusy, verror, va_reset, nenh_a_reset, vt_error, ext_error, next_error, vh_reset, nenoa_rst, acceptout, rosysout_s34[1..0], entestbusy, abortout, clrtestbusy, lbusy[5..1], lbusymask[5..1], lerror[5..1], lerrormask[5..1], lf_error[5..1], lf_errormask[5..1], ttypout_s24[2..0], seltt[2..0], ctpdl[15..0], testenout, clk_1, wrcontr1, bcn0gflt, neninitreset, local_bcn0_s24, ttyp[2..0], rosys[1..0]; "dummy inputs NODE acceptout1; OUTPUT trig_a, trig_h, ntrig_a, cal_h, oa_reset, noa_reset, cal_trig, cal_busy, ncal_busy, f_errorout, busy_1, nbusy_1, errorout, t_errorout, nerrorout, h_reset, not_reset, busyout, int_busy, a_reset, na_reset, testbusy, testpulse, testcal_h, "busys a_accept, trig_in, initialise, fltaccept, fcstp, "trigger_mpxers mbusy, merror, mf_error, testpulse_busy, ntestpulse_busy, testenclk1, acceptclk[3..1], a_abort, local_mode, gflt_mode, init_reset, ninit_reset, da[1..0], lasttrig_abort, m_busy_s34; "SPARE I/O "--------- INPUT s14[4]; "spare outputs. " INPUT s24[0]; "spare outputs. was [4], 3 now used by ttypout_s24. " " none available, 1 now used by local_bcn0_s24. INPUT s34[1]; "spare outputs. 2 now used by rosysout_s34[1..0], " and 1 by m_busy_s34. "------------------------------------------------------------------------------------------------ " Code "------------------------------------------------------------------------------------------------ f_err_and_busy (mf_error, vf_error, mbusy, vbusy, nclk_4, noa_rst, "TO PLD-4/1 f_errorout, busy_1, nbusy_1); "FROM cal_and_oa_rst (s_rst, vmoa_reset, vcalibrate, nclk_5, clk_6, noa_rst, "TO PLD-4/2 cal_h, oa_reset, noa_reset); "FROM cal_trig_delay (cal_h, ntrig_a, cctdl[5..0], clk_6, noa_rst, "TO PLD-4/3 cal_trig, cal_busy, ncal_busy); "FROM not_reset (busy_1, cal_busy, int_busy, testbusy, errorout, acceptclk[3..1], "TO PLD-4/4 nenoa_rst, vh_reset, nclk_4, nclk_5, noa_rst, init_reset, local_mode, "TO h_reset, not_reset, busyout, m_busy_s34); "FROM triggers (envar_trig, ncal_busy, m_busy_s34, s_trig, ext_trig, vtrigger, cal_trig, "TO PLD-4/5 nclk_4, nclk_5, noa_rst, "TO trig_a, trig_h, ntrig_a); "FROM error_and_a_reset (merror, verror, va_reset, not_reset, nenh_a_reset, nclk_4, noa_rst, "TO PLD-4/6 vt_error, ext_error, next_error, "TO errorout, a_reset, na_reset, t_errorout, nerrorout); "FROM busys (acceptclk[3..1], noa_rst, entestbusy, abortout, clrtestbusy, nclk_4, "TO PLD-4/7 int_busy, testbusy); "FROM trigger_mpxers (acceptout1, rosysout_s34[1..0], trig_h, nclk_5, trig_a, nclk_4, noa_rst, "TO PLD-4/8 local_mode, gflt_mode, cal_h, testcal_h, "TO a_accept, trig_in, initialise, fltaccept, fcstp); "FROM slave_masking (lbusy, lbusymask, lerror, lerrormask, "TO PLD-4/9 lf_error, lf_errormask, "TO mbusy, merror, mf_error); "FROM test_pulse_and_delay (testenclk1, ttypout_s24[2..0], seltt[2..0], noa_rst, clk_6, ctpdl[15..0], "TO PLD-4/10 testpulse_busy, ntestpulse_busy, testpulse, testcal_h); "FROM clocks (testenout, clk_1, acceptout, a_accept, nclk_4, trig_a, noa_rst, abortout, "TO PLD-4/11 testenclk1, acceptclk[3..1], a_abort, acceptout1); "FROM mode_init (wrcontr1, noa_rst, initialise, bcn0gflt, neninitreset, h_reset, "TO PLD-4/12 local_bcn0_s24, "TO local_mode, gflt_mode, init_reset, ninit_reset); "FROM select_lines (noa_rst, a_accept, nclk_4, "TO PLD-4/13 da[1..0]); "FROM last_abort (a_accept, abortout, noa_rst, "TO PLD-4/14 lasttrig_abort); "FROM "================================================================================================