1 |
21 |
jcastillo |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// Checker ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the SystemC AES ////
|
6 |
|
|
//// ////
|
7 |
|
|
//// Description: ////
|
8 |
|
|
//// Check that the outputs from the RTL model and the C model ////
|
9 |
|
|
//// used as golden model are the same ////
|
10 |
|
|
//// ////
|
11 |
|
|
//// To Do: ////
|
12 |
|
|
//// - done ////
|
13 |
|
|
//// ////
|
14 |
|
|
//// Author(s): ////
|
15 |
|
|
//// - Javier Castillo, jcastilo@opencores.org ////
|
16 |
|
|
//// ////
|
17 |
|
|
//////////////////////////////////////////////////////////////////////
|
18 |
|
|
//// ////
|
19 |
|
|
//// Copyright (C) 2000 Authors and OPENCORES.ORG ////
|
20 |
|
|
//// ////
|
21 |
|
|
//// This source file may be used and distributed without ////
|
22 |
|
|
//// restriction provided that this copyright statement is not ////
|
23 |
|
|
//// removed from the file and that any derivative work contains ////
|
24 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
25 |
|
|
//// ////
|
26 |
|
|
//// This source file is free software; you can redistribute it ////
|
27 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
28 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
29 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
30 |
|
|
//// later version. ////
|
31 |
|
|
//// ////
|
32 |
|
|
//// This source is distributed in the hope that it will be ////
|
33 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
34 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
35 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
36 |
|
|
//// details. ////
|
37 |
|
|
//// ////
|
38 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
39 |
|
|
//// Public License along with this source; if not, download it ////
|
40 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
41 |
|
|
//// ////
|
42 |
|
|
//////////////////////////////////////////////////////////////////////
|
43 |
|
|
//
|
44 |
|
|
// CVS Revision History
|
45 |
|
|
//
|
46 |
|
|
// $Log: not supported by cvs2svn $
|
47 |
|
|
// Revision 1.3 2004/08/30 14:47:38 jcastillo
|
48 |
|
|
// Code formated
|
49 |
|
|
//
|
50 |
|
|
// Revision 1.1.1.1 2004/07/05 09:46:22 jcastillo
|
51 |
|
|
// First import
|
52 |
|
|
//
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
#include "systemc.h"
|
56 |
|
|
|
57 |
|
|
SC_MODULE(checker)
|
58 |
|
|
{
|
59 |
|
|
|
60 |
|
|
sc_in<bool> reset;
|
61 |
|
|
|
62 |
|
|
sc_fifo_in<sc_biguint<128> > rt_aes_data_i;
|
63 |
|
|
sc_fifo_in<sc_biguint<128> > c_aes_data_i;
|
64 |
|
|
|
65 |
|
|
void check()
|
66 |
|
|
{
|
67 |
|
|
sc_biguint<128> rt_data_var, c_data_var;
|
68 |
|
|
|
69 |
|
|
wait(reset->posedge_event());
|
70 |
|
|
|
71 |
|
|
while (1)
|
72 |
|
|
{
|
73 |
|
|
if (reset.read())
|
74 |
|
|
{
|
75 |
|
|
rt_data_var = rt_aes_data_i.read();
|
76 |
|
|
c_data_var = c_aes_data_i.read();
|
77 |
|
|
if (rt_data_var != c_data_var)
|
78 |
|
|
{
|
79 |
|
|
cout << "Simulation mismatch: 0x" << (int)(sc_uint < 32 >)rt_data_var.range(127, 96) << (int)(sc_uint < 32 >)rt_data_var.range(95, 64) << (int)(sc_uint < 32 >)rt_data_var.range(31, 0) << " 0x" << (int)(sc_uint < 32 >)c_data_var.range(127, 96) << (int)(sc_uint < 32 >)c_data_var.range(95, 64) << (int)(sc_uint < 32 >)c_data_var.range(63, 32) << (int)(sc_uint < 32 >)c_data_var.range(31, 0) << " " << sc_time_stamp() << endl;
|
80 |
|
|
exit(0);
|
81 |
|
|
}
|
82 |
|
|
else
|
83 |
|
|
{
|
84 |
|
|
cout << "OK: 0x" << (int)(sc_uint < 32 >)rt_data_var.range(127, 96) << (int)(sc_uint < 32 >)rt_data_var.range(95, 64) << (int)(sc_uint < 32 >)rt_data_var.range(31, 0) << " 0x" << (int)(sc_uint < 32 >)c_data_var.range(127, 96) << (int)(sc_uint < 32 >)c_data_var.range(95, 64) << (int)(sc_uint < 32 >)c_data_var.range(63, 32) << (int)(sc_uint < 32 >)c_data_var.range(31, 0) << " " << sc_time_stamp() << endl;
|
85 |
|
|
}
|
86 |
|
|
}
|
87 |
|
|
else
|
88 |
|
|
wait(reset->posedge_event());
|
89 |
|
|
}
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
SC_CTOR(checker)
|
93 |
|
|
{
|
94 |
|
|
SC_THREAD(check);
|
95 |
|
|
}
|
96 |
|
|
};
|