datareg <= datareg is the problem I think. You have to use datareg <= some_input;
l
datareg <= datareg is the problem I think. You have to use datareg <= some_input;