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

Subversion Repositories sc2v

[/] [sc2v/] [tags/] [arelease/] [examples/] [md5.h] - Blame information for rev 2

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

powered by: WebSVN 2.1.0

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