1 |
2 |
jsauermann |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
2 |
|
|
"http://www.w3.org/TR/html4/strict.dtd">
|
3 |
|
|
<HTML>
|
4 |
|
|
<HEAD>
|
5 |
|
|
<TITLE>html/Listing_of_reg_16.vhd</TITLE>
|
6 |
|
|
<META NAME="generator" CONTENT="HTML::TextToHTML v2.46">
|
7 |
|
|
<LINK REL="stylesheet" TYPE="text/css" HREF="lecture.css">
|
8 |
|
|
</HEAD>
|
9 |
|
|
<BODY>
|
10 |
|
|
<P><table class="ttop"><th class="tpre"><a href="21_Listing_of_prog_mem.vhd.html">Previous Lesson</a></th><th class="ttop"><a href="toc.html">Table of Content</a></th><th class="tnxt"><a href="23_Listing_of_register_file.vhd.html">Next Lesson</a></th></table>
|
11 |
|
|
<hr>
|
12 |
|
|
|
13 |
|
|
<H1><A NAME="section_1">22 LISTING OF reg_16.vhd</A></H1>
|
14 |
|
|
|
15 |
|
|
<pre class="vhdl">
|
16 |
|
|
|
17 |
|
|
1 -------------------------------------------------------------------------------
|
18 |
|
|
2 --
|
19 |
|
|
3 -- Copyright (C) 2009, 2010 Dr. Juergen Sauermann
|
20 |
|
|
4 --
|
21 |
|
|
5 -- This code is free software: you can redistribute it and/or modify
|
22 |
|
|
6 -- it under the terms of the GNU General Public License as published by
|
23 |
|
|
7 -- the Free Software Foundation, either version 3 of the License, or
|
24 |
|
|
8 -- (at your option) any later version.
|
25 |
|
|
9 --
|
26 |
|
|
10 -- This code is distributed in the hope that it will be useful,
|
27 |
|
|
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
28 |
|
|
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
29 |
|
|
13 -- GNU General Public License for more details.
|
30 |
|
|
14 --
|
31 |
|
|
15 -- You should have received a copy of the GNU General Public License
|
32 |
|
|
16 -- along with this code (see the file named COPYING).
|
33 |
|
|
17 -- If not, see http://www.gnu.org/licenses/.
|
34 |
|
|
18 --
|
35 |
|
|
19 -------------------------------------------------------------------------------
|
36 |
|
|
20 -------------------------------------------------------------------------------
|
37 |
|
|
21 --
|
38 |
|
|
22 -- Module Name: Register - Behavioral
|
39 |
|
|
23 -- Create Date: 12:37:55 10/28/2009
|
40 |
|
|
24 -- Description: a register pair of a CPU.
|
41 |
|
|
25 --
|
42 |
|
|
26 ----------------------------------------------------------------------------------
|
43 |
|
|
27 library IEEE;
|
44 |
|
|
28 use IEEE.STD_LOGIC_1164.ALL;
|
45 |
|
|
29 use IEEE.STD_LOGIC_ARITH.ALL;
|
46 |
|
|
30 use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
47 |
|
|
31
|
48 |
|
|
32 entity reg_16 is
|
49 |
|
|
33 port ( I_CLK : in std_logic;
|
50 |
|
|
34
|
51 |
|
|
35 I_D : in std_logic_vector (15 downto 0);
|
52 |
|
|
36 I_WE : in std_logic_vector ( 1 downto 0);
|
53 |
|
|
37
|
54 |
|
|
38 Q : out std_logic_vector (15 downto 0));
|
55 |
|
|
39 end reg_16;
|
56 |
|
|
40
|
57 |
|
|
41 architecture Behavioral of reg_16 is
|
58 |
|
|
42
|
59 |
|
|
43 signal L : std_logic_vector (15 downto 0) := X"7777";
|
60 |
|
|
44 begin
|
61 |
|
|
45
|
62 |
|
|
46 process(I_CLK)
|
63 |
|
|
47 begin
|
64 |
|
|
48 if (rising_edge(I_CLK)) then
|
65 |
|
|
49 if (I_WE(1) = '1') then
|
66 |
|
|
50 L(15 downto 8) <= I_D(15 downto 8);
|
67 |
|
|
51 end if;
|
68 |
|
|
52 if (I_WE(0) = '1') then
|
69 |
|
|
53 L( 7 downto 0) <= I_D( 7 downto 0);
|
70 |
|
|
54 end if;
|
71 |
|
|
55 end if;
|
72 |
|
|
56 end process;
|
73 |
|
|
57
|
74 |
|
|
58 Q <= L;
|
75 |
|
|
59
|
76 |
|
|
60 end Behavioral;
|
77 |
|
|
61
|
78 |
|
|
<pre class="filename">
|
79 |
|
|
src/reg_16.vhd
|
80 |
|
|
</pre></pre>
|
81 |
|
|
<P>
|
82 |
|
|
|
83 |
|
|
<P><hr><BR>
|
84 |
|
|
<table class="ttop"><th class="tpre"><a href="21_Listing_of_prog_mem.vhd.html">Previous Lesson</a></th><th class="ttop"><a href="toc.html">Table of Content</a></th><th class="tnxt"><a href="23_Listing_of_register_file.vhd.html">Next Lesson</a></th></table>
|
85 |
|
|
</BODY>
|
86 |
|
|
</HTML>
|