integer to bcd

Gast #1505945
Lesenswert?

Liebe Kollegen!

Ich habe ein Modul geschrieben, dass einen Integer Wert in ein array 
schreibt. Leider funktioniert die if-Abfrage für das negative Vorzeichen 
nicht. Kann mir bitte jemand sagen was ich übersehe?
1
when rdy =>
2
...
3
if count = 31 then
4
   count <= 0;
5
   rd   <= '1';
6
   if vz = '1' then
7
      a(1) <= "1111";
8
   else
9
      a(1) <= s_shift(63 downto 60);
10
   end if;
11
   a(2) <= s_shift(59 downto 56);
12
   a(3) <= s_shift(55 downto 52);
13
   a(4) <= s_shift(51 downto 48);
14
   a(5) <= s_shift(47 downto 44);
15
   a(6) <= s_shift(43 downto 40);
16
   a(7) <= s_shift(39 downto 36);
17
   a(8) <= s_shift(35 downto 32);
18
   s_state <= idle;
19
else
20
   count <= count + 1;
21
   s_state <= shift;
22
end if; 
23
end case;
24
...
25

26
package myarray is
27
  type stdarray is array (1 to 8) of std_logic_vector (3 downto 0);
28

29
end package myarray;

das nächste Modul sendet das array and die RS232. Deshalb verwende ich 
für ein Minus "1111" weil das RS232 Modul alles in ASCII umwandelt.

DANKE
Gast #1505949
Lesenswert?

Sorry, vergessen
1
entity i2bcd is
2
Port    ( clk      : in  std_logic;
3
          reset    : in  std_logic;
4
          enable   : in  std_logic;
5
          i        : in  integer;
6
          rd       : out std_logic;
7
          --vz       : out std_logic;
8
          --st       : in  integer;
9
          a        : out stdarray
10
         ); --(1 to st+1));
11
end i2bcd;
12

13

14

15
architecture Behavioral of i2bcd is 
16
 
17
type    t_state is (idle, shift, add, rdy);
18
signal  s_state : t_state;
19
          
20
signal count   : integer;
21
signal s_shift : std_logic_vector (63 downto 0);
22
signal vz     : std_logic;

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren