There are two unsigned inputs, a0-a4 and b0-b4. These are converted to signed using the twos compliment number system and multiplied to give a 10 bit output. The output is clocked into a 10 bit d-type flip flop array. The unsigned inputs are then changed to a different number, repeating the process above another two times with different d-type flip flop arrays. This gives three 10 bit outputs, which then need to be added together. (This is for a matrix multiplier). I need the sign extension as the circuit needs to be able to accept both signed and unsigned numbers.
I'm using the count function to generate the test vectors. The problem I'm getting looks like this. When testing, (511+255+127 = 893). That's absolutely fine, working no problem. As soon as a negative number is included, the problem arises. Example from testing, (-512+256+128 = 896). Obviously this should be displaying an answer of -128! I've tried around 40 different combinations of adders and keep hitting the same issue...