What is "negative RAM"?
inout has to be used for bidirectional ports that are also driven from the upper instance (the port must be tristated internally to allow this). Notice that internal bidirectional busses aren't possible in most hardware platforms, they must be emulated by the synthesis tool.
To allow read-back of an out port, you can declare it as buffer, or use an auxilary internal signal (like ds). It's not clear from your post what's "not working" with your code.
i am doing my 2nd year graduation of electronics and communcation..
i have only basic knowledge...it is NEGATIVE RAMP WAVE GENERATOR sorry i wasnt specific i will post the code below
.
RAMP
my code in exam (i didnt get any output in exam in CRO )
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity rampwg is
Port ( clk,rst : in std_logic;
d : out std_logic_vector(11 downto 0));
end rampwg;
architecture Behavioral of rampwg is
signal clk_div:std_logic_vector(25 downto 0);
signal clkdiv:std_logic;
signal ds :std_logic_vector(11 downto 0);
begin
process(clk)
begin
if rising_edge(clk) then
clk_div<= clk_div+'1';
end if;
end process;
clkdiv<=clk_div(1);
process (clkdiv)
begin
if rst='1' then ds<=(others=>'0');
elsif rising_edge(clkdiv) then
ds<= ds-1;
end if;
end process;
d<=ds;
end Behavioral;
code in lab manual (i didnt remember that inout has to be used so i used above code)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity rampwg is
Port ( clk,rst : in std_logic;
d : inout std_logic_vector(11 downto 0));
end rampwg;
architecture Behavioral of rampwg is
signal clk_div:std_logic_vector(25 downto 0);
signal clkdiv:std_logic;
begin
process(clk)
begin
if rising_edge(clk) then
clk_div<= clk_div+'1';
end if;
end process;
clkdiv<=clk_div(1);
process (clkdiv)
begin
if rst='1' then d<=(others=>'0');
elsif rising_edge(clkdiv) then
d<= d-1;
end if;
end process;
end Behavioral;