1 |
8 |
yapzihe |
----------------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- WISHBONE RISCMCU IP Core ----
|
4 |
|
|
---- ----
|
5 |
|
|
---- This file is part of the RISCMCU project ----
|
6 |
|
|
---- http://www.opencores.org/projects/riscmcu/ ----
|
7 |
|
|
---- ----
|
8 |
|
|
---- Description ----
|
9 |
|
|
---- Implementation of a RISC Microcontroller based on Atmel AVR ----
|
10 |
|
|
---- AT90S1200 instruction set and features with Altera Flex10k20 FPGA. ----
|
11 |
|
|
---- ----
|
12 |
|
|
---- Author(s): ----
|
13 |
|
|
---- - Yap Zi He, yapzihe@hotmail.com ----
|
14 |
|
|
---- ----
|
15 |
|
|
----------------------------------------------------------------------------
|
16 |
|
|
---- ----
|
17 |
|
|
---- Copyright (C) 2001 Authors and OPENCORES.ORG ----
|
18 |
|
|
---- ----
|
19 |
|
|
---- This source file may be used and distributed without ----
|
20 |
|
|
---- restriction provided that this copyright statement is not ----
|
21 |
|
|
---- removed from the file and that any derivative work contains ----
|
22 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
23 |
|
|
---- ----
|
24 |
|
|
---- This source file is free software; you can redistribute it ----
|
25 |
|
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
26 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
27 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
28 |
|
|
---- later version. ----
|
29 |
|
|
---- ----
|
30 |
|
|
---- This source is distributed in the hope that it will be ----
|
31 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
32 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
33 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
34 |
|
|
---- details. ----
|
35 |
|
|
---- ----
|
36 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
37 |
|
|
---- Public License along with this source; if not, download it ----
|
38 |
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
39 |
|
|
---- ----
|
40 |
|
|
----------------------------------------------------------------------------
|
41 |
|
|
|
42 |
|
|
library ieee;
|
43 |
|
|
use ieee.std_logic_1164.all;
|
44 |
|
|
use ieee.std_logic_arith.all;
|
45 |
|
|
use ieee.std_logic_unsigned.all;
|
46 |
|
|
|
47 |
|
|
entity v_ir is
|
48 |
|
|
port( instruction : in std_logic_vector(15 downto 0);
|
49 |
|
|
en, clk, clrn : in std_logic;
|
50 |
|
|
ir : buffer std_logic_vector(15 downto 0);
|
51 |
|
|
imm_value : out std_logic_vector(7 downto 0);
|
52 |
|
|
rd, rr : out integer range 0 to 15
|
53 |
|
|
);
|
54 |
|
|
end v_ir;
|
55 |
|
|
|
56 |
|
|
architecture ir of v_ir is
|
57 |
|
|
begin
|
58 |
|
|
|
59 |
|
|
process(clk,clrn)
|
60 |
|
|
begin
|
61 |
|
|
if clrn = '0' then
|
62 |
|
|
ir <= "0000000000000000";
|
63 |
|
|
elsif clk'event and clk = '1' then
|
64 |
|
|
if en = '1' then
|
65 |
|
|
ir <= instruction;
|
66 |
|
|
end if;
|
67 |
|
|
end if;
|
68 |
|
|
end process;
|
69 |
|
|
|
70 |
|
|
imm_value <= ir(11 downto 8) & ir(3 downto 0);
|
71 |
|
|
rd <= conv_integer(ir(7 downto 4));
|
72 |
|
|
rr <= conv_integer(ir(3 downto 0));
|
73 |
|
|
|
74 |
|
|
end ir;
|