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

Subversion Repositories mod_mult_exp

[/] [mod_mult_exp/] [trunk/] [rtl/] [vhdl/] [mod_exp/] [blockMemory32/] [blockMemory/] [simulation/] [checker.vhd] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 gajos
 
2
--------------------------------------------------------------------------------
3
--
4
-- BLK MEM GEN v7_1 Core - Checker
5
--
6
--------------------------------------------------------------------------------
7
--
8
-- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved.
9
--
10
-- This file contains confidential and proprietary information
11
-- of Xilinx, Inc. and is protected under U.S. and
12
-- international copyright and other intellectual property
13
-- laws.
14
--
15
-- DISCLAIMER
16
-- This disclaimer is not a license and does not grant any
17
-- rights to the materials distributed herewith. Except as
18
-- otherwise provided in a valid license issued to you by
19
-- Xilinx, and to the maximum extent permitted by applicable
20
-- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
21
-- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
22
-- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
23
-- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
24
-- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
25
-- (2) Xilinx shall not be liable (whether in contract or tort,
26
-- including negligence, or under any other theory of
27
-- liability) for any loss or damage of any kind or nature
28
-- related to, arising under or in connection with these
29
-- materials, including for any direct, or any indirect,
30
-- special, incidental, or consequential loss or damage
31
-- (including loss of data, profits, goodwill, or any type of
32
-- loss or damage suffered as a result of any action brought
33
-- by a third party) even if such damage or loss was
34
-- reasonably foreseeable or Xilinx had been advised of the
35
-- possibility of the same.
36
--
37
-- CRITICAL APPLICATIONS
38
-- Xilinx products are not designed or intended to be fail-
39
-- safe, or for use in any application requiring fail-safe
40
-- performance, such as life-support or safety devices or
41
-- systems, Class III medical devices, nuclear facilities,
42
-- applications related to the deployment of airbags, or any
43
-- other applications that could lead to death, personal
44
-- injury, or severe property or environmental damage
45
-- (individually and collectively, "Critical
46
-- Applications"). Customer assumes the sole risk and
47
-- liability of any use of Xilinx products in Critical
48
-- Applications, subject only to applicable laws and
49
-- regulations governing limitations on product liability.
50
--
51
-- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
52
-- PART OF THIS FILE AT ALL TIMES.
53
 
54
--------------------------------------------------------------------------------
55
--
56
-- Filename: checker.vhd
57
--
58
-- Description:
59
--   Checker
60
--
61
--------------------------------------------------------------------------------
62
-- Author: IP Solutions Division
63
--
64
-- History: Sep 12, 2011 - First Release
65
--------------------------------------------------------------------------------
66
--
67
--------------------------------------------------------------------------------
68
-- Library Declarations
69
--------------------------------------------------------------------------------
70
 
71
LIBRARY IEEE;
72
USE IEEE.STD_LOGIC_1164.ALL;
73
USE IEEE.STD_LOGIC_ARITH.ALL;
74
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
75
 
76
LIBRARY work;
77
USE work.BMG_TB_PKG.ALL;
78
 
79
ENTITY CHECKER IS
80
  GENERIC ( WRITE_WIDTH : INTEGER :=32;
81
            READ_WIDTH  : INTEGER :=32
82
  );
83
 
84
  PORT (
85
        CLK      : IN STD_LOGIC;
86
        RST      : IN STD_LOGIC;
87
        EN       : IN STD_LOGIC;
88
        DATA_IN  : IN STD_LOGIC_VECTOR (READ_WIDTH-1 DOWNTO 0);   --OUTPUT VECTOR          
89
        STATUS   : OUT STD_LOGIC:= '0'
90
  );
91
END CHECKER;
92
 
93
ARCHITECTURE CHECKER_ARCH OF CHECKER IS
94
  SIGNAL EXPECTED_DATA : STD_LOGIC_VECTOR(READ_WIDTH-1 DOWNTO 0);
95
  SIGNAL DATA_IN_R: STD_LOGIC_VECTOR(READ_WIDTH-1 DOWNTO 0);
96
  SIGNAL EN_R : STD_LOGIC := '0';
97
  SIGNAL EN_2R : STD_LOGIC := '0';
98
--DATA PART CNT DEFINES THE ASPECT RATIO AND GIVES THE INFO TO THE DATA GENERATOR TO PROVIDE THE DATA EITHER IN PARTS OR COMPLETE DATA IN ONE SHOT
99
--IF READ_WIDTH > WRITE_WIDTH DIVROUNDUP RESULTS IN '1' AND DATA GENERATOR GIVES THE DATAOUT EQUALS TO MAX OF (WRITE_WIDTH, READ_WIDTH)
100
--IF READ_WIDTH < WRITE-WIDTH DIVROUNDUP RESULTS IN > '1' AND DATA GENERATOR GIVES THE DATAOUT IN TERMS OF PARTS(EG 4 PARTS WHEN WRITE_WIDTH 32 AND READ WIDTH 8)
101
  CONSTANT DATA_PART_CNT: INTEGER:= DIVROUNDUP(WRITE_WIDTH,READ_WIDTH);
102
  CONSTANT MAX_WIDTH: INTEGER:= IF_THEN_ELSE((WRITE_WIDTH>READ_WIDTH),WRITE_WIDTH,READ_WIDTH);
103
  SIGNAL ERR_HOLD : STD_LOGIC :='0';
104
  SIGNAL ERR_DET : STD_LOGIC :='0';
105
BEGIN
106
   PROCESS(CLK)
107
   BEGIN
108
     IF(RISING_EDGE(CLK)) THEN
109
       IF(RST= '1') THEN
110
          EN_R <= '0';
111
          EN_2R <= '0';
112
          DATA_IN_R <= (OTHERS=>'0');
113
       ELSE
114
              EN_R <= EN;
115
              EN_2R <= EN_R;
116
          DATA_IN_R <= DATA_IN;
117
       END IF;
118
     END IF;
119
   END PROCESS;
120
 
121
   EXPECTED_DATA_GEN_INST:ENTITY work.DATA_GEN
122
      GENERIC MAP ( DATA_GEN_WIDTH =>MAX_WIDTH,
123
                    DOUT_WIDTH     => READ_WIDTH,
124
                            DATA_PART_CNT  => DATA_PART_CNT,
125
                        SEED           => 2
126
      )
127
      PORT MAP (
128
            CLK      => CLK,
129
                        RST      => RST,
130
            EN       => EN_2R,
131
            DATA_OUT => EXPECTED_DATA
132
          );
133
 
134
   PROCESS(CLK)
135
   BEGIN
136
      IF(RISING_EDGE(CLK)) THEN
137
         IF(EN_2R='1') THEN
138
                 IF(EXPECTED_DATA = DATA_IN_R) THEN
139
                    ERR_DET<='0';
140
                 ELSE
141
                    ERR_DET<= '1';
142
                 END IF;
143
         END IF;
144
     END IF;
145
   END PROCESS;
146
 
147
   PROCESS(CLK,RST)
148
   BEGIN
149
          IF(RST='1') THEN
150
                 ERR_HOLD <= '0';
151
      ELSIF(RISING_EDGE(CLK)) THEN
152
         ERR_HOLD <= ERR_HOLD  OR ERR_DET ;
153
      END IF;
154
   END PROCESS;
155
 
156
   STATUS <= ERR_HOLD;
157
 
158
END ARCHITECTURE;
159
 
160
 
161
 

powered by: WebSVN 2.1.0

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