M
Massi
Guest
Hi all.
Some time ago, i found on this ng a GIANT help for my vhdl problems, so i'm
here again to mess you all
I'm trying (again) to create a simple module, intended to do this function:
take in input a value, if this value is in a defined period output the
value, else take the value in the period adding or subtracting the period
value.
I had 2 way yo try: do everything as a finite state machine (ARG) -> many
work, many problems, bad code
The other way (i thought) was trying to do the module using simple
processes.
That's what i wanted to do: the first process (controlled by the clock)
works on the input value: if it's out of the period changes it, else simply
modify a local signal named "local_signal" (ie )
The second process is controlled by this local signal, and on the rising
edge of the signal generates the output.
Obviously, nothing works so the question is: is this a valid way, or it will
never work in this way?
Thank you very much!
Just to enjoy you, i post here my test code
library IEEE;
use IEEE.std_logic_1164.all;
use ieee.std_logic_signed.all;
use ieee.std_logic_arith.all;
entity Discretizer is
port(
BININ : in std_logic_vector(0 to 15);
BINOUT : out std_logic_vector(0 to 15)
);
end Discretizer;
architecture rrgen of Discretizer is
constant pi : std_logic_vector(0 to 15) := "0000001100100100";
constant duepi : std_logic_vector(0 to 15) := "0000011001001000";
constant pimezzi : std_logic_vector(0 to 15) := "0000000110010010";
signal clk: bit;
signal TEMP_BININ: SIGNED(BININ'range);
signal create_output: bit;
begin
TEMP_BININ <= SIGNED(BININ);
-- Data
data: process( CLK )
begin
if( create_output = '1' ) then
create_output <= '0';
end if;
if( signed(TEMP_BININ) < -signed(pi) ) then
TEMP_BININ <= TEMP_BININ + signed(duepi);
end if;
if( signed(TEMP_BININ) > signed(pi) ) then
TEMP_BININ <= TEMP_BININ - signed(duepi);
end if;
if( signed(TEMP_BININ) < signed(pi) and signed(TEMP_BININ)
end process;
-- output register
output_register: process( create_output )
begin
if( create_output'event and create_output = '1' ) then
BINOUT <= std_logic_vector( TEMP_BININ );
end if;
end process;
end rrgen;
Some time ago, i found on this ng a GIANT help for my vhdl problems, so i'm
here again to mess you all
I'm trying (again) to create a simple module, intended to do this function:
take in input a value, if this value is in a defined period output the
value, else take the value in the period adding or subtracting the period
value.
I had 2 way yo try: do everything as a finite state machine (ARG) -> many
work, many problems, bad code
The other way (i thought) was trying to do the module using simple
processes.
That's what i wanted to do: the first process (controlled by the clock)
works on the input value: if it's out of the period changes it, else simply
modify a local signal named "local_signal" (ie )
The second process is controlled by this local signal, and on the rising
edge of the signal generates the output.
Obviously, nothing works so the question is: is this a valid way, or it will
never work in this way?
Thank you very much!
Just to enjoy you, i post here my test code
library IEEE;
use IEEE.std_logic_1164.all;
use ieee.std_logic_signed.all;
use ieee.std_logic_arith.all;
entity Discretizer is
port(
BININ : in std_logic_vector(0 to 15);
BINOUT : out std_logic_vector(0 to 15)
);
end Discretizer;
architecture rrgen of Discretizer is
constant pi : std_logic_vector(0 to 15) := "0000001100100100";
constant duepi : std_logic_vector(0 to 15) := "0000011001001000";
constant pimezzi : std_logic_vector(0 to 15) := "0000000110010010";
signal clk: bit;
signal TEMP_BININ: SIGNED(BININ'range);
signal create_output: bit;
begin
TEMP_BININ <= SIGNED(BININ);
-- Data
data: process( CLK )
begin
if( create_output = '1' ) then
create_output <= '0';
end if;
if( signed(TEMP_BININ) < -signed(pi) ) then
TEMP_BININ <= TEMP_BININ + signed(duepi);
end if;
if( signed(TEMP_BININ) > signed(pi) ) then
TEMP_BININ <= TEMP_BININ - signed(duepi);
end if;
if( signed(TEMP_BININ) < signed(pi) and signed(TEMP_BININ)
end if;-signed(pi) ) then
create_output <= '1';
end process;
-- output register
output_register: process( create_output )
begin
if( create_output'event and create_output = '1' ) then
BINOUT <= std_logic_vector( TEMP_BININ );
end if;
end process;
end rrgen;