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

Subversion Repositories RISCMCU

[/] [RISCMCU/] [trunk/] [vhdl/] [v_sr.vhd] - Blame information for rev 28

Details | Compare with Previous | View Log

Line No. Rev Author Line
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_sr is
46
        port(   clk,clrn: in std_logic;
47
                        sren,tosr : in std_logic_vector(6 downto 0);
48
                        srsel : in integer range 0 to 7;
49
                        clr_i,set_i,bset,bclr : in std_logic;
50
                        rd_sreg, wr_sreg : in std_logic;
51
                        c : inout std_logic_vector(7 downto 0);
52
                        sr : inout std_logic_vector(7 downto 0)
53
        );
54
end v_sr;
55
 
56
architecture sr of v_sr is
57
begin
58
 
59
c <=    sr when rd_sreg = '1' else
60
                "ZZZZZZZZ";
61
 
62
process(clk,clrn,rd_sreg,sr)
63
begin
64
        if clrn = '0' then
65
                sr <= "00000000";
66
        elsif clk'event and clk = '1' then
67
                if wr_sreg = '1' then
68
                        sr <= c;
69
                elsif bset = '1' or bclr = '1' then
70
                        sr(srsel) <= bset;
71
                elsif clr_i = '1' or set_i = '1' then
72
                        sr(7) <= set_i;
73
                else
74
                        for i in 0 to 6 loop
75
                                if sren(i) = '1' then
76
                                        sr(i) <= tosr(i);
77
                                end if;
78
                        end loop;
79
                end if;
80
        end if;
81
 
82
end process;
83
 
84
end sr;
85
 
86
 

powered by: WebSVN 2.1.0

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