module compexp
title 'Expansion logic for 64-bit comparator' 
" COMPEXP device 'P16V8'; 

" Inputs from the individual comparators, all active-low, 7 = MSByte 
EQ_L7..EQ_L0, GT_L7..GT_L0                pin 1..11, 13..14, 21..23;
" Comparison outputs
PEQQ, PNEQ, PGTQ, PGEQ, PLTQ, PLEQ        pin 15..20 istype 'com';

" Active-level conversions
EQ7 = !EQ_L7; EQ6 = !EQ_L6; EQ5 = !EQ_L5; EQ4 = !EQ_L4; 
EQ3 = !EQ_L3; EQ2 = !EQ_L2; EQ1 = !EQ_L1; EQ0 = !EQ_L0; 
GT7 = !GT_L7; GT6 = !GT_L6; GT5 = !GT_L5; GT4 = !GT_L4; 
GT3 = !GT_L3; GT2 = !GT_L2; GT1 = !GT_L1; GT0 = !GT_L0; 

equations

PEQQ = EQ7 & EQ6 & EQ5 & EQ4 & EQ3 & EQ2 & EQ1 & EQ0;

PNEQ = !(EQ7 & EQ6 & EQ5 & EQ4 & EQ3 & EQ2 & EQ1 & EQ0);




end compexp
