Simulating an IP core in Modelsim is delayed by one clock cycle
I suddenly found what's wrong with my program. It's the timescale. I set the timescale to be 1ps / 1ps, which is not enough for the ip core to work correctly. When I change the timescale to 1ns / 1ps, it works correnctly.