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

Subversion Repositories jart

[/] [jart/] [branches/] [ver0branch/] [scanFF.vhd] - Blame information for rev 80

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jguarin200
-- Author : Julian Andres Guarin Reyes.
2
-- Project : JART, Just Another Ray Tracer.
3
-- email : jguarin2002 at gmail.com, j.guarin at javeriana.edu.co
4
 
5
-- This code was entirely written by Julian Andres Guarin Reyes.
6
-- The following code is licensed under GNU Public License
7
-- http://www.gnu.org/licenses/gpl-3.0.txt.
8
 
9
 -- This file is part of JART (Just Another Ray Tracer).
10
 
11
    -- JART (Just Another Ray Tracer) is free software: you can redistribute it and/or modify
12
    -- it under the terms of the GNU General Public License as published by
13
    -- the Free Software Foundation, either version 3 of the License, or
14
    -- (at your option) any later version.
15
 
16
    -- JART (Just Another Ray Tracer) is distributed in the hope that it will be useful,
17
    -- but WITHOUT ANY WARRANTY; without even the implied warranty of
18
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
    -- GNU General Public License for more details.
20
 
21
    -- You should have received a copy of the GNU General Public License
22
    -- along with JART (Just Another Ray Tracer).  If not, see <http://www.gnu.org/licenses/>.
23
 
24
-- A scan flipflop hdl code. Note the logic function q <= (s0 and s ) or (s1 and ~s) its a mux with s as selector and s0 and s1 as selectable inputs.
25
library ieee;
26
use ieee.std_logic_1164.all;
27
 
28
 
29
entity scanFF is
30
        generic (       W       : integer := 8);
31 31 jguarin200
        port    (
32 60 jguarin200
                clk,rst,ena,sel         : in std_logic; -- The usual  control signals
33 12 jguarin200
 
34 60 jguarin200
                d0,d1   : in std_logic_vector (W-1 downto 0);    -- The two operands.
35
                q               : out std_logic_vector (W-1 downto 0)    -- The selected data.
36 31 jguarin200
 
37 12 jguarin200
        );
38
end entity;
39
 
40
architecture rtl of scanFF is
41 60 jguarin200
        signal mux: std_logic_vector (W-1 downto 0);
42 12 jguarin200
begin
43 60 jguarin200
        dff_ena_sel :for i in 0 to W-1 generate
44
                mux(i) <= (d1(i) and sel) or (d0(i) and not(sel));
45
 
46
                process (clk,rst,ena)
47 31 jguarin200
 
48 60 jguarin200
                begin
49 12 jguarin200
 
50 60 jguarin200
                        if rst = '0' then
51
                                q(i) <= '1';
52
                        elsif rising_edge (clk) and ena = '1' then
53
                                q(i) <= mux(i);
54 12 jguarin200
                        end if;
55 60 jguarin200
 
56
                end process;
57
 
58
        end generate;
59 31 jguarin200
end rtl;
60 12 jguarin200
 
61 31 jguarin200
 
62 12 jguarin200
 
63
 

powered by: WebSVN 2.1.0

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