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

Subversion Repositories leros

[/] [leros/] [trunk/] [vhdl/] [core/] [leros_im.vhd] - Blame information for rev 4

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 martin
--
2
--  Copyright 2011 Martin Schoeberl <masca@imm.dtu.dk>,
3
--                 Technical University of Denmark, DTU Informatics. 
4
--  All rights reserved.
5
--
6
-- Redistribution and use in source and binary forms, with or without
7
-- modification, are permitted provided that the following conditions are met:
8
-- 
9
--    1. Redistributions of source code must retain the above copyright notice,
10
--       this list of conditions and the following disclaimer.
11
-- 
12
--    2. Redistributions in binary form must reproduce the above copyright
13
--       notice, this list of conditions and the following disclaimer in the
14
--       documentation and/or other materials provided with the distribution.
15
-- 
16
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS
17
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
-- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
19
-- NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
-- 
27
-- The views and conclusions contained in the software and documentation are
28
-- those of the authors and should not be interpreted as representing official
29
-- policies, either expressed or implied, of the copyright holder.
30
-- 
31
 
32
library ieee;
33
use ieee.std_logic_1164.all;
34
use ieee.numeric_std.all;
35
 
36
use work.leros_types.all;
37
 
38
-- instruction memory
39
-- write is ignored for now
40
-- the content should be generated by an assembler
41
 
42
entity leros_im is
43
        port  (
44
                clk : in std_logic;
45
                reset : in std_logic;
46
                din : in im_in_type;
47
                dout : out im_out_type
48
        );
49
end leros_im;
50
 
51
architecture rtl of leros_im is
52
 
53
        signal areg             : std_logic_vector(IM_BITS-1 downto 0);
54
        signal data             : std_logic_vector(15 downto 0);
55
 
56
begin
57
 
58
process(clk) begin
59
 
60
        if rising_edge(clk) then
61
                areg <= din.rdaddr;
62
        end if;
63
 
64
end process;
65
 
66
        dout.data <= data;
67
 
68
        rom: entity work.leros_rom port map(areg, data);
69
 
70
-- use generated table
71
-- process(areg) begin
72
-- 
73
--      case areg is
74
-- 
75
--              when X"00" => data <= X"0000"; -- never executed
76
--              when X"01" => data <= X"0805"; -- load imm
77
--              when X"02" => data <= X"0e01"; -- sub 1 
78
--              when X"03" => data <= X"0e01"; -- sub 1 
79
--              when X"04" => data <= X"f000"; -- nop
80
--              when X"05" => data <= X"10fe"; -- brnz
81
--              when X"06" => data <= X"f000"; -- nop
82
--              when X"07" => data <= X"0801"; -- load 1
83
--              when X"08" => data <= X"2000"; -- outp
84
--              when X"09" => data <= X"0805"; -- load imm
85
--              when X"0a" => data <= X"0e01"; -- sub 1 
86
--              when X"0b" => data <= X"0e01"; -- sub 1 
87
--              when X"0c" => data <= X"f000"; -- nop
88
--              when X"0d" => data <= X"10fe"; -- brnz
89
--              when X"0e" => data <= X"f000"; -- nop
90
--              when X"0f" => data <= X"0800"; -- load 0
91
--              when X"10" => data <= X"2000"; -- outp
92
--              when X"11" => data <= X"0801"; -- load imm
93
--              when X"12" => data <= X"f000"; -- nop
94
--              when X"13" => data <= X"10ee"; -- brnz
95
--              when others => data <= X"f000"; 
96
--      end case;
97
-- end process;
98
 
99
end rtl;

powered by: WebSVN 2.1.0

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