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

Subversion Repositories bluespec_md6

[/] [bluespec_md6/] [trunk/] [compressionFunction/] [src/] [MD6ShiftRegister.bsv] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 kfleming
//----------------------------------------------------------------------//
2
// The MIT License
3
//
4
// Copyright (c) 2008 Kermin Fleming, kfleming@mit.edu
5
//
6
// Permission is hereby granted, free of charge, to any person
7
// obtaining a copy of this software and associated documentation
8
// files (the "Software"), to deal in the Software without
9
// restriction, including without limitation the rights to use,
10
// copy, modify, merge, publish, distribute, sublicense, and/or sell
11
// copies of the Software, and to permit persons to whom the
12
// Software is furnished to do so, subject to the following conditions:
13
//
14
// The above copyright notice and this permission notice shall be
15
// included in all copies or substantial portions of the Software.
16
//
17
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
// OTHER DEALINGS IN THE SOFTWARE.
25
//----------------------------------------------------------------------//
26 2 kfleming
import FIFOF::*;
27
import MD6Parameters::*;
28
import MD6Types::*;
29
import CompressionFunctionTypes::*;
30
import CompressionFunctionParameters::*;
31
import CompressionFunctionLibrary::*;
32
import Debug::*;
33
import SGenerator::*;
34
import Vector::*;
35
 
36
interface MD6ShiftRegister#(numeric type taps);
37
  method Vector#(taps,MD6Word) getT0;
38
  method Vector#(taps,MD6Word) getT1;
39
  method Vector#(taps,MD6Word) getT2;
40
  method Vector#(taps,MD6Word) getT3;
41
  method Vector#(taps,MD6Word) getT4;
42
  method Vector#(taps,MD6Word) getT5;
43
  method Action write(Vector#(taps,MD6Word) nextValues);
44
  method Action advance();
45
  interface Vector#(MD6_n, Reg#(MD6Word)) regs;
46
endinterface
47
 
48
 
49
module mkMD6ShiftRegister (MD6ShiftRegister#(taps))
50
  provisos(Add#(taps,yyy,MD6_n));
51
  Integer historyLength = valueof(taps);
52
  Vector#(MD6_n,Reg#(MD6Word)) t0 <- replicateM(mkReg(0));
53
  // we pulled out a subtraction of history length
54
  method Vector#(taps,MD6Word) getT0;
55
    return takeAt(determineT0,readVReg(t0));
56
  endmethod
57
 
58
  method Vector#(taps,MD6Word) getT1;
59
    return  takeAt(determineT1,readVReg(t0));
60
  endmethod
61
 
62
  method Vector#(taps,MD6Word) getT2;
63
    return  takeAt(determineT2,readVReg(t0));
64
  endmethod
65
 
66
  method Vector#(taps,MD6Word) getT3;
67
    return  takeAt(determineT3,readVReg(t0));
68
  endmethod
69
 
70
  method Vector#(taps,MD6Word) getT4;
71
    return  takeAt(determineT4,readVReg(t0));
72
  endmethod
73
 
74
  method Vector#(taps,MD6Word) getT5;
75
    return  takeAt(determineT5,readVReg(t0));
76
  endmethod
77
 
78
  method Action  write(Vector#(taps,MD6Word) nextword);
79
    writeVReg(takeAt(valueof(MD6_n)-valueof(taps),t0),nextword);
80
  endmethod
81
 
82
  method Action advance();
83
    for(Integer i = 0; i < valueof(MD6_n); i=i+1)
84
      begin
85
        //$display("Advance ShiftState[%d]: %h",i, t0[i]);
86
      end
87
    for(Integer i = 0; i < valueof(MD6_n)-valueof(taps); i=i+1)
88
      begin
89
        t0[i] <= t0[i+valueof(taps)];
90
      end
91
  endmethod
92
 
93
  interface regs = t0;
94
 
95
endmodule

powered by: WebSVN 2.1.0

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