Bonjour,
la compilation est ok.
Par contre, lorsque je simule, j'ai bien la visualisation de mon clock, mais le signal wave_out reste constant ("00000").
Je pense que le problème vient de l'architecture de sine_wave.
En effet, ne faudrait-il pas définir {table_index:table_index_type} en tant que signal ?
------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
use work.sinus.all;
-----
entity sine_wave is
port(
wave_out: out sine_vector_type
);
end;
-----
architecture arch1 of sine_wave is
--signal table_index:table_index_type;
signal clock : std_logic :='0';
begin
-----
process
begin
wait for 10 ns;
clock<='1';
wait for 10 ns;
clock<='0';
end process;
-----
process(clock)
variable table_value:table_value_type;
variable table_index:table_index_type;
begin
if clock'event and clock='1' then
if table_index=max_table_index then
table_index:=0;
else table_value := get_table_value (table_index);
end if;
end if;
wave_out<=std_logic_vector(to_ unsigned(table_value,sine_vect or_type'length));
end process;
-----
end arch1;
-------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
-----
package sinus is
constant max_table_value : integer := 15;
subtype table_value_type is integer range 0 to max_table_value;
constant max_table_index : integer :=15;
subtype table_index_type is integer range 0 to max_table_index;
subtype sine_vector_type is std_logic_vector (4 downto 0);
function get_table_value (table_index:table_index_type) return table_value_type;
end;
-----
package body sinus is
function get_table_value (table_index:table_index_type) return table_value_type is
variable table_value:table_value_type;
begin
case table_index is
when 0=>
table_value:=0;
when 1=>
table_value:=1;
when 2=>
table_value:=2;
when 3=>
table_value:=3;
when 4=>
table_value:=4;
when 5=>
table_value:=5;
when 6=>
table_value:=6;
when 7=>
table_value:=7;
when 8=>
table_value:=8;
when 9=>
table_value:=9;
when 10=>
table_value:=10;
when 11=>
table_value:=11;
when 12=>
table_value:=12;
when 13=>
table_value:=13;
when 14=>
table_value:=14;
when 15=>
table_value:=15;
end case;
return table_value;
end;
end;
-------------------------------------------------
Cordialement
DELALIN Ambroise
-----