copyleft: gplv3 added and set repo to public
[calu.git] / cpu / src / extension_pkg.vhd
index 102a181c6a8b0137e9ec7e2879ace1c4b6547f9f..3d18a1998204a519dd7c3544977e5eea82fe3e2a 100644 (file)
@@ -1,3 +1,24 @@
+--   `Deep Thought', a softcore CPU implemented on a FPGA
+--
+--  Copyright (C) 2010 Markus Hofstaetter <markus.manrow@gmx.at>
+--  Copyright (C) 2010 Martin Perner <e0725782@student.tuwien.ac.at>
+--  Copyright (C) 2010 Stefan Rebernig <stefan.rebernig@gmail.com>
+--  Copyright (C) 2010 Manfred Schwarz <e0725898@student.tuwien.ac.at>
+--  Copyright (C) 2010 Bernhard Urban <lewurm@gmail.com>
+--
+--  This program is free software: you can redistribute it and/or modify
+--  it under the terms of the GNU General Public License as published by
+--  the Free Software Foundation, either version 3 of the License, or
+--  (at your option) any later version.
+--
+--  This program is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--  GNU General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License
+--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 library IEEE;
 
 use IEEE.std_logic_1164.all;
@@ -34,14 +55,17 @@ type status_rec is record
                carry : std_logic;
 end record;
 
-constant EXT_7SEG_ADDR:   ext_addrid_t := x"0000201";
-constant EXT_EXTMEM_ADDR: ext_addrid_t := x"FFFFFFB";
-constant EXT_TIMER_ADDR:  ext_addrid_t := x"FFFFFFC";
-constant EXT_AC97_ADDR:   ext_addrid_t := x"FFFFFFD";
--- constant EXT_UART_ADDR:   ext_addrid_t := x"FFFFFFE";
+procedure put_word_be (tmp : out gp_register_t; signal reg : in gp_register_t; signal byte_en : byte_en_t);
+
+-- Addressen der bis jetzt vorhanden extensions
 constant EXT_UART_ADDR:   ext_addrid_t := x"0000200";
+constant EXT_7SEG_ADDR:   ext_addrid_t := x"0000201";
 constant EXT_INT_ADDR:   ext_addrid_t := x"0000202";
 constant EXT_IMP_ADDR:   ext_addrid_t := x"0000203";
+constant EXT_TIMER_ADDR:  ext_addrid_t := x"0000204";
+-- dummy addressen
+constant EXT_EXTMEM_ADDR: ext_addrid_t := x"FFFFFFB";
+constant EXT_AC97_ADDR:   ext_addrid_t := x"FFFFFFD";
 constant EXT_GPMP_ADDR:    ext_addrid_t := x"FFFFFFF";
 
 component extension_gpm is
@@ -91,3 +115,14 @@ component extension_interrupt is
 
 
 end package extension_pkg;
+
+package body extension_pkg is
+       procedure put_word_be (tmp : out gp_register_t; signal reg : in gp_register_t; signal byte_en : byte_en_t) is
+       begin
+               for i in 0 to 3 loop
+                       if byte_en(i) = '1' then
+                               tmp(((i+1)*byte_t'length-1) downto i*byte_t'length) := reg(((i+1)*byte_t'length-1) downto i*byte_t'length);
+                       end if;
+               end loop;
+       end;
+end package body extension_pkg;