Facebook
From dodotronix, 8 Months ago, written in VHDL.
This paste is a reply to vhdl from ff - go back
Embed
Viewing differences between vhdl and Re: vhdl
LIBRARY ieee;
USE ieee.std_logic_1164.ALL; 
USE ieee.std_logic_arith.ALL; 

ENTITY ram_dual IS
        PORT (
                        clock: IN STD_LOGIC;
                        data: IN STD_LOGIC_VECTOR (3 DOWNTO 0);
                        write_address: IN INTEGER RANGE 0 to 31;
                        read_address: IN INTEGER RANGE 0 to 31;
                        we: IN STD_LOGIC;
                        q: OUT STD_LOGIC_VECTOR (3 DOWNTO 0)
);
END ram_dual;

ARCHITECTURE rtl OF ram_dual IS
TYPE MEM IS ARRAY(0 TO 31) OF STD_LOGIC_VECTOR(3 DOWNTO 0);
SIGNAL ram_block: MEM;
SIGNAL read_address_reg 
rdAddr: process(resetAddrManager, RX_FRAMECLK_I)
  variable timer         
INTEGER RANGE 0 to 31;
BEGIN
                PROCESS (clock)
                        BEGIN
                        IF (clock1'event AND clock1 = '1') THEN
                                IF (we = '1') THEN
                                        ram_block(write_address) <= data;
                                else q <= ram_block(read_address);--mozliwe ze trzeba bedzie bez elsa znaczy end if; potem q<=...
                                END IF;
                        END IF;
      END PROCESS;


END rtl; 

-------------------------------------------------------------

LIBRARY ieee;
USE ieee.std_logic_1164.ALL; 
USE ieee.std_logic_arith.ALL; 

ENTITY ram IS
        PORT ( data: IN std_logic_vector (3 downto 0);
        wren,clock, acc, acc2: IN std_logic;
END ram;

architecture behavior of ram is
        signal wyjscie: std_logic_vector(0 to 3);
        signal address: 
integer Range range 0 to 31 := 0;
        signal address2: 
RX_GB_READ_DLY;
    variable readAddress   : 
integer Range range to 31 to  7;
  
 begin
 
  if resetAddrManager = '1' then
   readAddress    
:= 0;
        signal v1: std_logic_vector (0 to 3);
        signal v2: std_logic_vector (0 to 3);

        component ram_dual IS
                Port(        
                        clock: IN STD_LOGIC;
                        data: IN STD_LOGIC_VECTOR (3 downto 0);
                        write_address: IN Integer Range 0 to 31 
1;
   readRSM_s      <= e0_wait;
   timer          
:= 0;
                        read_address: IN Integer Range 0 to 31 
0;
   READY_O        <= '0';
   READ_ADDRESS_O <= (others => '0');
   
  elsif rising_edge(RX_FRAMECLK_I) then
  
     if RX_CLKEN_i = '1' then
    case readRSM_s is
    
     when e0_wait => if timer >= RX_GB_READ_DLY then
            readRSM_s <= e1_read;
            
           else
            timer 
:= 0;
                        we: In STD_LOGIC;
                        q: OUT STD_LOGIC_VECTOR (3 downto 0));
        
timer + 1;
           
end component ram_dual;

        PROCESS(clock)
                BEGIN 
                        IF (acc'event AND acc 
if;
    
     when e1_read   => readAddress := readAddress + 1;
           if readAddress 
'1') THEN
                                address 
1 then  -- Ready after one full read to be sure that all register contains true data
              READY_O     
<= address + 1;
                                v1 
'1';
           end if;
           
    end case;
    
    READ_ADDRESS_O  
<= conv_std_logic_vector (address, 4);
                        END IF;
                
                        IF(acc2'event AND acc2 = '1') THEN
                                address2 <= address2 + 1;
                                v2 <= conv_std_logic_vector(address2,4);
                        END IF;
        END PROCESS;
        
ram_one: ram_dual port map(clock, data, address, address2, wren, wyjscie);        
                
END behavior;
std_logic_Vector(to_unsigned(readAddress, 3));
   end if;
   
  end if;
  
 end process;

Replies to Re: vhdl rss

Title Name Language When
Re: Re: vhdl dodotronix vhdl 8 Months ago.