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

Subversion Repositories systemcaes

[/] [systemcaes/] [trunk/] [rtl/] [systemc/] [aes192lowarea/] [main.cpp] - Blame information for rev 28

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 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
 
47
#include "systemc.h"
48
#include "iostream.h"
49
#include "aes.h"
50
#include "aesfunctions.h"
51
#include "aesmodel.h"
52
#include "stimulus.h"
53
#include "adapt.h"
54
#include "checker.h"
55
 
56
int sc_main(int argc, char* argv[]){
57
 
58
    sc_clock clk("clk",20);
59
 
60
        test *t;
61
    aes_transactor *tr;
62
    aes *ae1;
63
        aesmodel *am1;
64
        adapter *ad1;
65
        checker *ch1;
66
 
67
        t=new test("testbench");
68
    tr=new aes_transactor("aes_transactor");
69
    am1=new aesmodel("aes_C_model");
70
        ae1=new aes("aes");
71
        ad1=new adapter("adapter");
72
        ch1=new checker("checker");
73
 
74
        t->transactor(*tr);
75
 
76
        sc_signal<bool> reset;
77
        sc_signal<bool> rt_load;
78
        sc_signal<bool> rt_decrypt;
79
        sc_signal<sc_biguint<128> > rt_data_i;
80
        sc_signal<sc_biguint<192> > rt_key;
81
 
82
        sc_signal<sc_biguint<128> > rt_data_o;
83
        sc_signal<bool> rt_ready;
84
 
85
        sc_fifo<sc_biguint<128> > rt_aes_data_ck;
86
        sc_fifo<sc_biguint<128> > c_aes_data_ck;
87
 
88
        sc_fifo<bool> c_decrypt;
89
        sc_fifo<sc_biguint<192> > c_key;
90
        sc_fifo<sc_biguint<128> > c_data;
91
 
92
        ch1->reset(reset);
93
        ch1->rt_aes_data_i(rt_aes_data_ck);
94
        ch1->c_aes_data_i(c_aes_data_ck);
95
 
96
        ad1->clk(clk);
97
        ad1->rt_ready_i(rt_ready);
98
        ad1->rt_aes_data_i(rt_data_o);
99
        ad1->rt_aes_data_o(rt_aes_data_ck);
100
 
101
        am1->decrypt(c_decrypt);
102
        am1->aes_key_i(c_key);
103
        am1->aes_data_i(c_data);
104
        am1->aes_data_o(c_aes_data_ck);
105
 
106
        ae1->clk(clk);
107
    ae1->reset(reset);
108
        ae1->load_i(rt_load);
109
        ae1->decrypt_i(rt_decrypt);
110
        ae1->data_i(rt_data_i);
111
        ae1->key_i(rt_key);
112
        ae1->data_o(rt_data_o);
113
        ae1->ready_o(rt_ready);
114
 
115
        tr->clk(clk);
116
    tr->reset(reset);
117
        //Ports to RT model
118
        tr->rt_load_o(rt_load);
119
        tr->rt_decrypt_o(rt_decrypt);
120
        tr->rt_aes_data_o(rt_data_i);
121
        tr->rt_aes_key_o(rt_key);
122
        tr->rt_aes_ready_i(rt_ready);
123
        //Ports to C model
124
        tr->c_decrypt_o(c_decrypt);
125
        tr->c_aes_key_o(c_key);
126
        tr->c_aes_data_o(c_data);
127
 
128
        sc_start(-1);
129
 
130
        return 0;
131
 
132
  }

powered by: WebSVN 2.1.0

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