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

Subversion Repositories systemcaes

[/] [systemcaes/] [trunk/] [bench/] [systemc/] [aes128lowarea/] [main.cpp] - Blame information for rev 28

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 21 jcastillo
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Main simulation file                                        ////
4
////                                                              ////
5
////  This file is part of the SystemC AES                        ////
6
////                                                              ////
7
////  Description:                                                ////
8
////  Connect all the modules and begin the simulation            ////
9
////                                                              ////
10
////  To Do:                                                      ////
11
////   - done                                                     ////
12
////                                                              ////
13
////  Author(s):                                                  ////
14
////      - Javier Castillo, jcastilo@opencores.org               ////
15
////                                                              ////
16
//////////////////////////////////////////////////////////////////////
17
////                                                              ////
18
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
19
////                                                              ////
20
//// This source file may be used and distributed without         ////
21
//// restriction provided that this copyright statement is not    ////
22
//// removed from the file and that any derivative work contains  ////
23
//// the original copyright notice and the associated disclaimer. ////
24
////                                                              ////
25
//// This source file is free software; you can redistribute it   ////
26
//// and/or modify it under the terms of the GNU Lesser General   ////
27
//// Public License as published by the Free Software Foundation; ////
28
//// either version 2.1 of the License, or (at your option) any   ////
29
//// later version.                                               ////
30
////                                                              ////
31
//// This source is distributed in the hope that it will be       ////
32
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
33
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
34
//// PURPOSE.  See the GNU Lesser General Public License for more ////
35
//// details.                                                     ////
36
////                                                              ////
37
//// You should have received a copy of the GNU Lesser General    ////
38
//// Public License along with this source; if not, download it   ////
39
//// from http://www.opencores.org/lgpl.shtml                     ////
40
////                                                              ////
41
//////////////////////////////////////////////////////////////////////
42
//
43
// CVS Revision History
44
//
45
// $Log: not supported by cvs2svn $
46
// Revision 1.2  2004/08/30 14:47:38  jcastillo
47
// Code formated
48
//
49
// Revision 1.1.1.1  2004/07/05 09:46:22  jcastillo
50
// First import
51
//
52
 
53
#include "systemc.h"
54
#include "iostream.h"
55
#include "aes.h"
56
#include "aesfunctions.h"
57
#include "aesmodel.h"
58
#include "stimulus.h"
59
#include "adapt.h"
60
#include "checker.h"
61
 
62
int sc_main(int argc, char *argv[])
63
{
64
 
65
        sc_clock clk("clk", 20);
66
 
67
        test *t;
68
        aes_transactor *tr;
69
        aes *ae1;
70
        aesmodel *am1;
71
        adapter *ad1;
72
        checker *ch1;
73
 
74
        t = new test("testbench");
75
        tr = new aes_transactor("aes_transactor");
76
        am1 = new aesmodel("aes_C_model");
77
        ae1 = new aes("aes");
78
        ad1 = new adapter("adapter");
79
        ch1 = new checker("checker");
80
 
81
        t->transactor(*tr);
82
 
83
        sc_signal<bool> reset;
84
        sc_signal<bool> rt_load;
85
        sc_signal<bool> rt_decrypt;
86
        sc_signal<sc_biguint<128> > rt_data_i;
87
        sc_signal<sc_biguint<128> > rt_key;
88
 
89
        sc_signal<sc_biguint<128> > rt_data_o;
90
        sc_signal<bool>rt_ready;
91
 
92
        sc_fifo<sc_biguint<128> > rt_aes_data_ck;
93
        sc_fifo<sc_biguint<128> > c_aes_data_ck;
94
 
95
        sc_fifo<bool> c_decrypt;
96
        sc_fifo<sc_biguint <128> > c_key;
97
        sc_fifo<sc_biguint <128> > c_data;
98
 
99
        ch1->reset(reset);
100
        ch1->rt_aes_data_i(rt_aes_data_ck);
101
        ch1->c_aes_data_i(c_aes_data_ck);
102
 
103
        ad1->clk(clk);
104
        ad1->rt_ready_i(rt_ready);
105
        ad1->rt_aes_data_i(rt_data_o);
106
        ad1->rt_aes_data_o(rt_aes_data_ck);
107
 
108
        am1->decrypt(c_decrypt);
109
        am1->aes_key_i(c_key);
110
        am1->aes_data_i(c_data);
111
        am1->aes_data_o(c_aes_data_ck);
112
 
113
        ae1->clk(clk);
114
        ae1->reset(reset);
115
        ae1->load_i(rt_load);
116
        ae1->decrypt_i(rt_decrypt);
117
        ae1->data_i(rt_data_i);
118
        ae1->key_i(rt_key);
119
        ae1->data_o(rt_data_o);
120
        ae1->ready_o(rt_ready);
121
 
122
        tr->clk(clk);
123
        tr->reset(reset);
124
        //Ports to RT model
125
        tr->rt_load_o(rt_load);
126
        tr->rt_decrypt_o(rt_decrypt);
127
        tr->rt_aes_data_o(rt_data_i);
128
        tr->rt_aes_key_o(rt_key);
129
        tr->rt_aes_ready_i(rt_ready);
130
        //Ports to C model
131
        tr->c_decrypt_o(c_decrypt);
132
        tr->c_aes_key_o(c_key);
133
        tr->c_aes_data_o(c_data);
134
 
135
        sc_start(-1);
136
 
137
        return 0;
138
 
139
}

powered by: WebSVN 2.1.0

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