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

Subversion Repositories sc2v

[/] [sc2v/] [trunk/] [examples/] [md5.h] - Blame information for rev 39

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

Line No. Rev Author Line
1 2 jcastillo
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  MD5 header                                                  ////
4
////                                                              ////
5
////  This file is part of the SystemC MD5                        ////
6
////                                                              ////
7
////  Description:                                                ////
8
////  MD5 top file header                                         ////
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 4 jcastillo
// Revision 1.1.1.1  2004/10/08 14:04:10  jcastillo
47
// First import
48
//
49 2 jcastillo
// Revision 1.1.1.1  2004/09/08 16:24:49  jcastillo
50
// Initial release
51
//
52
 
53
#include "systemc.h"
54
 
55
SC_MODULE (md5)
56
{
57
 
58
  sc_in < bool > clk;
59
  sc_in < bool > reset;
60
 
61
  sc_in < bool > load_i;
62
  sc_out < bool > ready_o;
63
  sc_in < bool > newtext_i;
64
 
65
 
66
  //Input must be padded and in little endian mode
67
  sc_in < sc_biguint < 128 > >data_i;
68
  sc_out < sc_biguint < 128 > >data_o;
69
 
70
 
71
  //Signals
72
  sc_signal < sc_uint < 32 > >ar, br, cr, dr;
73
  sc_signal < sc_uint < 32 > >next_ar, next_br, next_cr, next_dr;
74
  sc_signal < sc_uint < 32 > >A, B, C, D;
75
  sc_signal < sc_uint < 32 > >next_A, next_B, next_C, next_D;
76
 
77
  sc_signal < bool > next_ready_o;
78
  sc_signal < sc_biguint < 128 > >next_data_o;
79
 
80
  sc_signal < sc_biguint < 512 > >message, next_message;
81
  sc_signal < bool > generate_hash, hash_generated, next_generate_hash;
82
 
83
  sc_signal < sc_uint < 3 > >getdata_state, next_getdata_state;
84
 
85
  sc_signal < sc_uint < 2 > >round, next_round;
86
  sc_signal < sc_uint < 6 > >round64, next_round64;
87
 
88
  sc_signal < sc_uint < 44 > >t;
89
 
90
  sc_signal < sc_uint < 32 > >func_out;
91
 
92
  void md5_getdata ();
93
  void reg_signal ();
94
  void round64FSM ();
95
  void md5_rom ();
96
  void funcs ();
97 4 jcastillo
 
98 2 jcastillo
  SC_CTOR (md5)
99
  {
100
 
101
    SC_METHOD (reg_signal);
102 4 jcastillo
    sensitive_pos (clk);
103
    sensitive_neg (reset);
104 2 jcastillo
 
105
    SC_METHOD (md5_getdata);
106
    sensitive << newtext_i << data_i << load_i << getdata_state <<
107
      hash_generated << message;
108
    sensitive << func_out << A << B << C << D << ar << br << cr << dr <<
109
      generate_hash;
110
 
111
    SC_METHOD (round64FSM);
112
    sensitive << newtext_i << round << round64 << ar << br << cr << dr <<
113
      generate_hash << func_out;
114
    sensitive << getdata_state << A << B << C << D;
115
 
116
 
117
    SC_METHOD (md5_rom);
118
    sensitive << round64;
119
 
120
    SC_METHOD (funcs);
121
    sensitive << t << ar << br << cr << dr << round << message << func_out;
122
 
123
  }
124
};

powered by: WebSVN 2.1.0

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