Add bounds checking for signal slices
Merge two functions into cgen_array_off