Icy Snow wrote:
> code
Whats the problem with it? Whats the problem at all?
Is this any good for:
> xold
It isn't used in the code, so it must be obsolete...
This will create an error:
1 | xnew <= std_logic_vector(unsigned(D_in)); -- what type is xnew?
|
This does not behave like you desired it:
1 | process(CLK_I)
|
2 | begin
|
3 | if( rising_edge(CLK_I) ) then
|
4 | xnew <= std_logic_vector(unsigned(D_in));
|
5 | xnew <= xnew - "010";
|
You know about the behaviour of signal in a process?
You will find out, that the fist assignment is simply ignored, and
therefore xnew is simply a down-counter with a decrement of 2. In fact
you could write this process without any change in behaviour like this:
1 | process(CLK_I)
|
2 | begin
|
3 | if( rising_edge(CLK_I) ) then
|
4 | xnew <= xnew - "010";
|
> Test case:
> Clk 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
> D_IN 0 0 0 2 4 7 6 0 2 4 6 3 5 7 0 0 0 0
Did you create a test bench out of this data? How does it look like?
All in all you are a lucky man: you don't have to do last milleniums
technology like structural description of a multiplier built of
halfadders. Insted you got a problem fairly near to what is the daily
work of a FPGA designer.
BTW:
Did you see this above the edit box?
1 | Formatting options
|
2 | [vhdl]VHDL code[/vhdl]
|