Reg_size is set to 4. Prime input is 16 which is 5-bit number. So instead of doing % 16, it does % 0. There's no functional issue since inputs are 0-15 and are all valid. Need to increase input size to 5 and pad MSB of w-input with 0 to make sure it's doing % 16.