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

Subversion Repositories systemcdes

[/] [systemcdes/] [trunk/] [bench/] [systemc/] [stimulus.cpp] - Blame information for rev 12

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

Line No. Rev Author Line
1 2 jcastillo
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Random stimulus generation                                  ////
4
////                                                              ////
5
////  This file is part of the SystemC DES                        ////
6
////                                                              ////
7
////  Description:                                                ////
8
////  DES random stimulus                                         ////
9
////                                                              ////
10
////  To Do:                                                      ////
11
////   - nothing                                                  ////
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 6 jcastillo
// Revision 1.2  2004/08/30 16:55:54  jcastillo
47
// Used indent command on C code
48
//
49
// Revision 1.1.1.1  2004/07/05 17:31:18  jcastillo
50
// First import
51
//
52 2 jcastillo
 
53
 
54
 
55
 
56 6 jcastillo
#include "stimulus.h"
57 2 jcastillo
 
58 6 jcastillo
void
59
test::tb ()
60
{
61
 
62
  sc_uint < 64 > des_key_var, des_data_var;
63 2 jcastillo
  bool decrypt_var;
64 6 jcastillo
 
65
  scv_random::set_global_seed (53246);
66
 
67
  random_generator rg ("random_generator");
68
 
69
  transactor->resetea ();
70
 
71
  while (1)
72
    {
73
 
74
      rg.des_key->next ();
75
      rg.des_data->next ();
76
      rg.decrypt->next ();
77
 
78
 
79
      des_data_var = *(rg.des_data);
80
      des_key_var = *(rg.des_key);
81
      decrypt_var = *(rg.decrypt);
82
 
83
      if (!decrypt_var)
84
        {
85
          cout << "Encrypt: 0x" << (int) des_data_var.range (63,32) << (int)des_data_var.range (31,0) << " 0x" << (int) des_key_var.range (63,32) << (int) des_key_var.range (31,0) << " " << sc_time_stamp () << endl;
86
          transactor->encrypt (des_data_var, des_key_var);
87 2 jcastillo
        }
88 6 jcastillo
      else
89
        {
90
          cout << "Decrypt: 0x" << (int) des_data_var.range (63,32) << (int)des_data_var.range (31,0) << " 0x" << (int) des_key_var.range (63,32) << (int) des_key_var.range (31,0) << " " << sc_time_stamp () << endl;
91
          transactor->decrypt (des_data_var, des_key_var);
92
        }
93
    }
94
 
95 2 jcastillo
}

powered by: WebSVN 2.1.0

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