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 |
|
|
|
45 |
|
|
entity v_iodecoder is
|
46 |
|
|
port( ioaddr : in integer range 0 to 16#3f#;
|
47 |
|
|
rd_io, wr_io : in std_logic;
|
48 |
|
|
rd_sreg, wr_sreg : out std_logic;
|
49 |
|
|
rd_gimsk, wr_gimsk, rd_timsk, wr_timsk, rd_tifr,wr_tifr : out std_logic;
|
50 |
|
|
rd_mcucr,wr_mcucr, rd_tccr0, wr_tccr0, rd_tcnt0,wr_tcnt0 : out std_logic;
|
51 |
|
|
rd_portb, wr_portb, rd_ddrb, wr_ddrb, rd_pinb : out std_logic;
|
52 |
|
|
rd_portc, wr_portc, rd_ddrc, wr_ddrc, rd_pinc : out std_logic;
|
53 |
|
|
rd_portd, wr_portd, rd_ddrd, wr_ddrd, rd_pind : out std_logic
|
54 |
|
|
);
|
55 |
|
|
end v_iodecoder;
|
56 |
|
|
|
57 |
|
|
architecture iodecoder of v_iodecoder is
|
58 |
|
|
begin
|
59 |
|
|
|
60 |
|
|
process(rd_io, ioaddr)
|
61 |
|
|
begin
|
62 |
|
|
|
63 |
|
|
rd_sreg <= '0';
|
64 |
|
|
rd_gimsk <= '0';
|
65 |
|
|
rd_timsk <= '0';
|
66 |
|
|
rd_tifr <= '0';
|
67 |
|
|
rd_mcucr <= '0';
|
68 |
|
|
rd_tccr0 <= '0';
|
69 |
|
|
rd_tcnt0 <= '0';
|
70 |
|
|
|
71 |
|
|
rd_portb <= '0';
|
72 |
|
|
rd_ddrb <= '0';
|
73 |
|
|
rd_pinb <= '0';
|
74 |
|
|
rd_portc <= '0';
|
75 |
|
|
rd_ddrc <= '0';
|
76 |
|
|
rd_pinc <= '0';
|
77 |
|
|
rd_portd <= '0';
|
78 |
|
|
rd_ddrd <= '0';
|
79 |
|
|
rd_pind <= '0';
|
80 |
|
|
|
81 |
|
|
if rd_io = '1' then
|
82 |
|
|
case ioaddr is
|
83 |
|
|
when 16#3f# => rd_sreg <= '1';
|
84 |
|
|
when 16#3b# => rd_gimsk <= '1';
|
85 |
|
|
when 16#39# => rd_timsk <= '1';
|
86 |
|
|
when 16#38# => rd_tifr <= '1';
|
87 |
|
|
when 16#35# => rd_mcucr <= '1';
|
88 |
|
|
when 16#33# => rd_tccr0 <= '1';
|
89 |
|
|
when 16#32# => rd_tcnt0 <= '1';
|
90 |
|
|
|
91 |
|
|
when 16#18# => rd_portb <= '1';
|
92 |
|
|
when 16#17# => rd_ddrb <= '1';
|
93 |
|
|
when 16#16# => rd_pinb <= '1';
|
94 |
|
|
when 16#15# => rd_portc <= '1';
|
95 |
|
|
when 16#14# => rd_ddrc <= '1';
|
96 |
|
|
when 16#13# => rd_pinc <= '1';
|
97 |
|
|
when 16#12# => rd_portd <= '1';
|
98 |
|
|
when 16#11# => rd_ddrd <= '1';
|
99 |
|
|
when 16#10# => rd_pind <= '1';
|
100 |
|
|
when others =>
|
101 |
|
|
end case;
|
102 |
|
|
end if;
|
103 |
|
|
end process;
|
104 |
|
|
|
105 |
|
|
process(wr_io, ioaddr)
|
106 |
|
|
begin
|
107 |
|
|
|
108 |
|
|
wr_sreg <= '0';
|
109 |
|
|
wr_gimsk <= '0';
|
110 |
|
|
wr_timsk <= '0';
|
111 |
|
|
wr_tifr <= '0';
|
112 |
|
|
wr_mcucr <= '0';
|
113 |
|
|
wr_tccr0 <= '0';
|
114 |
|
|
wr_tcnt0 <= '0';
|
115 |
|
|
|
116 |
|
|
wr_portb <= '0';
|
117 |
|
|
wr_ddrb <= '0';
|
118 |
|
|
wr_portc <= '0';
|
119 |
|
|
wr_ddrc <= '0';
|
120 |
|
|
wr_portd <= '0';
|
121 |
|
|
wr_ddrd <= '0';
|
122 |
|
|
|
123 |
|
|
if wr_io = '1' then
|
124 |
|
|
case ioaddr is
|
125 |
|
|
when 16#3f# => wr_sreg <= '1';
|
126 |
|
|
when 16#3b# => wr_gimsk <= '1';
|
127 |
|
|
when 16#39# => wr_timsk <= '1';
|
128 |
|
|
when 16#38# => wr_tifr <= '1';
|
129 |
|
|
when 16#35# => wr_mcucr <= '1';
|
130 |
|
|
when 16#33# => wr_tccr0 <= '1';
|
131 |
|
|
when 16#32# => wr_tcnt0 <= '1';
|
132 |
|
|
|
133 |
|
|
when 16#18# => wr_portb <= '1';
|
134 |
|
|
when 16#17# => wr_ddrb <= '1';
|
135 |
|
|
when 16#15# => wr_portc <= '1';
|
136 |
|
|
when 16#14# => wr_ddrc <= '1';
|
137 |
|
|
when 16#12# => wr_portd <= '1';
|
138 |
|
|
when 16#11# => wr_ddrd <= '1';
|
139 |
|
|
when others =>
|
140 |
|
|
end case;
|
141 |
|
|
end if;
|
142 |
|
|
end process;
|
143 |
|
|
|
144 |
|
|
end iodecoder;
|