OpenCores
URL https://opencores.org/ocsvn/simu_mem/simu_mem/trunk

Subversion Repositories simu_mem

[/] [simu_mem/] [trunk/] [rtl/] [vhdl/] [ZBT_RAM_pkg.vhd] - Diff between revs 3 and 5

Only display areas with differences | Details | Blame | View Log

Rev 3 Rev 5
----------------------------------------------------------------------
----------------------------------------------------------------------
----                                                              ----
----                                                              ----
---- Synchronous static RAM ("Zero Bus Turnaround" RAM, ZBT RAM)  ----
---- Synchronous static RAM ("Zero Bus Turnaround" RAM, ZBT RAM)  ----
---- simulation model                                             ----
---- simulation model                                             ----
----                                                              ----
----                                                              ----
---- This file is part of the simu_mem project                    ----
---- This file is part of the simu_mem project                    ----
----                                                              ----
----                                                              ----
---- Description                                                  ----
---- Description                                                  ----
---- State definition and next state calculation function for     ----
---- State definition and next state calculation function for     ----
---- the ZBT RAM model                                            ----
---- the ZBT RAM model                                            ----
----                                                              ----
----                                                              ----
---- Authors:                                                     ----
---- Authors:                                                     ----
---- - Michael Geng, vhdl@MichaelGeng.de                          ----
---- - Michael Geng, vhdl@MichaelGeng.de                          ----
----                                                              ----
----                                                              ----
----------------------------------------------------------------------
----------------------------------------------------------------------
----                                                              ----
----                                                              ----
---- Copyright (C) 2008 Authors                                   ----
---- Copyright (C) 2008 Authors                                   ----
----                                                              ----
----                                                              ----
---- This source file may be used and distributed without         ----
---- This source file may be used and distributed without         ----
---- restriction provided that this copyright statement is not    ----
---- restriction provided that this copyright statement is not    ----
---- removed from the file and that any derivative work contains  ----
---- removed from the file and that any derivative work contains  ----
---- the original copyright notice and the associated disclaimer. ----
---- the original copyright notice and the associated disclaimer. ----
----                                                              ----
----                                                              ----
---- This source file is free software; you can redistribute it   ----
---- This source file is free software; you can redistribute it   ----
---- and/or modify it under the terms of the GNU Lesser General   ----
---- and/or modify it under the terms of the GNU Lesser General   ----
---- Public License as published by the Free Software Foundation; ----
---- Public License as published by the Free Software Foundation; ----
---- either version 2.1 of the License, or (at your option) any   ----
---- either version 2.1 of the License, or (at your option) any   ----
---- later version.                                               ----
---- later version.                                               ----
----                                                              ----
----                                                              ----
---- This source is distributed in the hope that it will be       ----
---- This source is distributed in the hope that it will be       ----
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ----
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ----
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ----
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ----
---- PURPOSE. See the GNU Lesser General Public License for more  ----
---- PURPOSE. See the GNU Lesser General Public License for more  ----
---- details.                                                     ----
---- details.                                                     ----
----                                                              ----
----                                                              ----
---- You should have received a copy of the GNU Lesser General    ----
---- You should have received a copy of the GNU Lesser General    ----
---- Public License along with this source; if not, download it   ----
---- Public License along with this source; if not, download it   ----
---- from http://www.opencores.org/lgpl.shtml                     ----
---- from http://www.opencores.org/lgpl.shtml                     ----
----                                                              ----
----                                                              ----
----------------------------------------------------------------------
----------------------------------------------------------------------
-- CVS Revision History
-- CVS Revision History
--
--
-- $Log: not supported by cvs2svn $
-- $Log: not supported by cvs2svn $
--
--
LIBRARY IEEE;
LIBRARY IEEE;
  USE IEEE.STD_LOGIC_1164.ALL;
  USE IEEE.STD_LOGIC_1164.ALL;
 
 
PACKAGE ZBT_RAM_pkg IS
PACKAGE ZBT_RAM_pkg IS
  TYPE state_type IS (
  TYPE state_type IS (
    sleep,
    sleep,
    deselect,
    deselect,
    deselect_continue,
    deselect_continue,
    read,
    read,
    read_continue,
    read_continue,
    dummy_read,
    dummy_read,
    dummy_read_continue,
    dummy_read_continue,
    write,
    write,
    write_continue,
    write_continue,
    write_abort,
    write_abort,
    write_abort_continue,
    write_abort_continue,
    invalid_state);
    invalid_state);
 
 
  FUNCTION calc_state (
  FUNCTION calc_state (
    CS1_n : STD_LOGIC;
    CS1_n : STD_LOGIC;
    CS2   : STD_LOGIC;
    CS2   : STD_LOGIC;
    CS2_n : STD_LOGIC;
    CS2_n : STD_LOGIC;
    WE_n  : STD_LOGIC;
    WE_n  : STD_LOGIC;
    BW_n  : STD_LOGIC_VECTOR;
    BW_n  : STD_LOGIC_VECTOR;
    OE_n  : STD_LOGIC;
    OE_n  : STD_LOGIC;
    ADV   : STD_LOGIC;
    ADV   : STD_LOGIC;
    ZZ    : STD_LOGIC;
    ZZ    : STD_LOGIC;
    operation : state_type) RETURN state_type;
    operation : state_type) RETURN state_type;
 
 
  FUNCTION calc_operation (
  FUNCTION calc_operation (
    state     : state_type;
    state     : state_type;
    operation : state_type) RETURN state_type;
    operation : state_type) RETURN state_type;
END PACKAGE ZBT_RAM_pkg;
END PACKAGE ZBT_RAM_pkg;
 
 
PACKAGE BODY ZBT_RAM_pkg IS
PACKAGE BODY ZBT_RAM_pkg IS
  FUNCTION calc_state (
  FUNCTION calc_state (
    CS1_n : STD_LOGIC;
    CS1_n : STD_LOGIC;
    CS2   : STD_LOGIC;
    CS2   : STD_LOGIC;
    CS2_n : STD_LOGIC;
    CS2_n : STD_LOGIC;
    WE_n  : STD_LOGIC;
    WE_n  : STD_LOGIC;
    BW_n  : STD_LOGIC_VECTOR;
    BW_n  : STD_LOGIC_VECTOR;
    OE_n  : STD_LOGIC;
    OE_n  : STD_LOGIC;
    ADV   : STD_LOGIC;
    ADV   : STD_LOGIC;
    ZZ    : STD_LOGIC;
    ZZ    : STD_LOGIC;
    operation : state_type) RETURN state_type IS
    operation : state_type) RETURN state_type IS
    VARIABLE selected : BOOLEAN;
    VARIABLE selected : BOOLEAN;
  BEGIN
  BEGIN
    selected := ((CS1_n = '0') AND (CS2 = '1') AND (CS2_n = '0'));
    selected := ((CS1_n = '0') AND (CS2 = '1') AND (CS2_n = '0'));
 
 
    IF (ZZ = '1') THEN
    IF (ZZ = '1') THEN
      RETURN sleep;
      RETURN sleep;
    ELSIF ((ADV = '0') AND (NOT selected)) THEN
    ELSIF ((ADV = '0') AND (NOT selected)) THEN
      RETURN deselect;
      RETURN deselect;
    ELSIF ((ADV = '1') AND (operation = deselect)) THEN
    ELSIF ((ADV = '1') AND (operation = deselect)) THEN
      RETURN deselect_continue;
      RETURN deselect_continue;
    ELSIF (selected AND (ADV = '0') AND (WE_n = '1') AND (OE_n = '0')) THEN
    ELSIF (selected AND (ADV = '0') AND (WE_n = '1') AND (OE_n = '0')) THEN
      RETURN read;
      RETURN read;
    ELSIF ((ADV = '1') AND (OE_n = '0') AND (operation = Read)) THEN
    ELSIF ((ADV = '1') AND (OE_n = '0') AND (operation = Read)) THEN
      RETURN read_continue;
      RETURN read_continue;
    ELSIF (selected AND (ADV = '0') AND (WE_n = '1') AND (OE_n = '1')) THEN
    ELSIF (selected AND (ADV = '0') AND (WE_n = '1') AND (OE_n = '1')) THEN
      RETURN dummy_read;
      RETURN dummy_read;
    ELSIF ((ADV = '1') AND (OE_n = '1') AND (operation = Read)) THEN
    ELSIF ((ADV = '1') AND (OE_n = '1') AND (operation = Read)) THEN
      RETURN dummy_read_continue;
      RETURN dummy_read_continue;
    ELSIF (selected AND (ADV = '0') AND (WE_n = '0') AND (BW_n /= (BW_n'range => '1'))) THEN
    ELSIF (selected AND (ADV = '0') AND (WE_n = '0') AND (BW_n /= (BW_n'range => '1'))) THEN
      RETURN write;
      RETURN write;
    ELSIF ((ADV = '1') AND (BW_n /= (BW_n'range => '1')) AND (operation = write)) THEN
    ELSIF ((ADV = '1') AND (BW_n /= (BW_n'range => '1')) AND (operation = write)) THEN
      RETURN write_continue;
      RETURN write_continue;
    ELSIF (selected AND (ADV = '0') AND (WE_n = '0') AND (BW_n = (BW_n'range => '1')) AND
    ELSIF (selected AND (ADV = '0') AND (WE_n = '0') AND (BW_n = (BW_n'range => '1')) AND
      (operation = Write)) THEN
      (operation = Write)) THEN
      RETURN write_abort;
      RETURN write_abort;
    ELSIF ((ADV = '1') AND (BW_n = (BW_n'range => '1')) AND (operation = write_abort)) THEN
    ELSIF ((ADV = '1') AND (BW_n = (BW_n'range => '1')) AND (operation = write_abort)) THEN
      RETURN write_abort_continue;
      RETURN write_abort_continue;
    ELSE
    ELSE
      RETURN invalid_state;
      RETURN invalid_state;
    END IF;
    END IF;
  END FUNCTION calc_state;
  END FUNCTION calc_state;
 
 
  FUNCTION calc_operation (
  FUNCTION calc_operation (
    state     : state_type;
    state     : state_type;
    operation : state_type) RETURN state_type IS
    operation : state_type) RETURN state_type IS
  BEGIN
  BEGIN
    CASE state IS
    CASE state IS
      WHEN deselect | write | write_abort | read =>
      WHEN deselect | write | write_abort | read =>
        RETURN state;
        RETURN state;
      WHEN dummy_read =>
      WHEN dummy_read =>
        RETURN read;
        RETURN read;
      WHEN OTHERS =>
      WHEN OTHERS =>
        RETURN operation;
        RETURN operation;
    END CASE;
    END CASE;
  END FUNCTION calc_operation;
  END FUNCTION calc_operation;
END PACKAGE BODY ZBT_RAM_pkg;
END PACKAGE BODY ZBT_RAM_pkg;
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.