marinet
Newbie level 4
- Joined
- Sep 2, 2013
- Messages
- 7
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 74
Hello,
I have written the following code but I do not take the right results from the addition: met <=met+monada;
I think that the problem is that I have the signal met twice.
Specifically, I take that the output nn is equal to 1..
At first I had that my signals and the output are this type: "sfixed" beacause I wanted to add fixed point numbers but then the following error was appeared:
expression has 7 elements, but must have 6 elements
Then I increased the number of elements and it appeared this error: expression has 8 elements, but must have 7 elements
What is my error?What I have to do?Please help me!!Thank you very much in advance..
I have written the following code but I do not take the right results from the addition: met <=met+monada;
I think that the problem is that I have the signal met twice.
Specifically, I take that the output nn is equal to 1..
At first I had that my signals and the output are this type: "sfixed" beacause I wanted to add fixed point numbers but then the following error was appeared:
expression has 7 elements, but must have 6 elements
Then I increased the number of elements and it appeared this error: expression has 8 elements, but must have 7 elements
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 LIBRARY ieee; USE ieee.std_logic_1164.all; library ieee_proposed; use ieee_proposed.fixed_pkg.all; use ieee.numeric_std.all; USE ieee.std_logic_signed.all; ENTITY adder IS PORT (z:IN SIGNED(2 DOWNTO 0) :="001"; nn:OUT signed (5 DOWNTO 0)); END adder; ARCHITECTURE behavior OF adder IS signal met:signed(5 DOWNTO 0); signal monada:signed(2 DOWNTO 0); signal meta:signed(5 DOWNTO 0); BEGIN PROCESS(met) -- variable count: integer range 26 downto 0; BEGIN --monada <= to_sfixed (1,monada); FOR i IN 1 TO 25 LOOP met <=met+1; -- met <=meta; END LOOP; FOR i IN 1 TO 5 LOOP IF(z=i) THEN nn<=met; END IF; END LOOP; END process; END behavior;
What is my error?What I have to do?Please help me!!Thank you very much in advance..
Last edited by a moderator: