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

Subversion Repositories cpu_lecture

[/] [cpu_lecture/] [trunk/] [html/] [25_Listing_of_status_reg.vhd.html] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
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_status_reg.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="24_Listing_of_segment7.vhd.html">Previous Lesson</a></th><th class="ttop"><a href="toc.html">Table of Content</a></th><th class="tnxt"><a href="26_Listing_of_uart_rx.vhd.html">Next Lesson</a></th></table>
11
<hr>
12
 
13
<H1><A NAME="section_1">25 LISTING OF status_reg.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:    16:15:54 12/26/2009
40
 24     -- Description:    the status register 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 status_reg is
49
 33         port (  I_CLK       : in  std_logic;
50
 34
51
 35                 I_COND      : in  std_logic_vector ( 3 downto 0);
52
 36                 I_DIN       : in  std_logic_vector ( 7 downto 0);
53
 37                 I_FLAGS     : in  std_logic_vector ( 7 downto 0);
54
 38                 I_WE_F      : in  std_logic;
55
 39                 I_WE_SR     : in  std_logic;
56
 40
57
 41                 Q           : out std_logic_vector ( 7 downto 0);
58
 42                 Q_CC        : out std_logic);
59
 43     end status_reg;
60
 44
61
 45     architecture Behavioral of status_reg is
62
 46
63
 47     signal L                : std_logic_vector ( 7 downto 0);
64
 48     begin
65
 49
66
 50         process(I_CLK)
67
 51         begin
68
 52             if (rising_edge(I_CLK)) then
69
 53                 if (I_WE_F = '1') then          -- write flags (from ALU)
70
 54                     L <= I_FLAGS;
71
 55                 elsif (I_WE_SR = '1') then      -- write I/O
72
 56                     L <= I_DIN;
73
 57                 end if;
74
 58             end if;
75
 59         end process;
76
 60
77
 61         cond: process(I_COND, L)
78
 62         begin
79
 63             case I_COND(2 downto 0) is
80
 64                 when "000"  => Q_CC <= L(0) xor I_COND(3);
81
 65                 when "001"  => Q_CC <= L(1) xor I_COND(3);
82
 66                 when "010"  => Q_CC <= L(2) xor I_COND(3);
83
 67                 when "011"  => Q_CC <= L(3) xor I_COND(3);
84
 68                 when "100"  => Q_CC <= L(4) xor I_COND(3);
85
 69                 when "101"  => Q_CC <= L(5) xor I_COND(3);
86
 70                 when "110"  => Q_CC <= L(6) xor I_COND(3);
87
 71                 when others => Q_CC <= L(7) xor I_COND(3);
88
 72             end case;
89
 73         end process;
90
 74
91
 75         Q <= L;
92
 76
93
 77     end Behavioral;
94
 78
95
<pre class="filename">
96
src/status_reg.vhd
97
</pre></pre>
98
<P>
99
 
100
<P><hr><BR>
101
<table class="ttop"><th class="tpre"><a href="24_Listing_of_segment7.vhd.html">Previous Lesson</a></th><th class="ttop"><a href="toc.html">Table of Content</a></th><th class="tnxt"><a href="26_Listing_of_uart_rx.vhd.html">Next Lesson</a></th></table>
102
</BODY>
103
</HTML>

powered by: WebSVN 2.1.0

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