OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [src_processor/] [aeMB/] [verilog/] [src/] [aeMB2_bsft.v] - Blame information for rev 16

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 alirezamon
/* $Id: aeMB2_bsft.v,v 1.3 2008-04-28 08:15:25 sybreon Exp $
2
**
3
** AEMB2 EDK 6.2 COMPATIBLE CORE
4
** Copyright (C) 2004-2008 Shawn Tan <shawn.tan@aeste.net>
5
**
6
** This file is part of AEMB.
7
**
8
** AEMB is free software: you can redistribute it and/or modify it
9
** under the terms of the GNU Lesser General Public License as
10
** published by the Free Software Foundation, either version 3 of the
11
** License, or (at your option) any later version.
12
**
13
** AEMB is distributed in the hope that it will be useful, but WITHOUT
14
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15
** or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
16
** Public License for more details.
17
**
18
** You should have received a copy of the GNU Lesser General Public
19
** License along with AEMB. If not, see <http:**www.gnu.org/licenses/>.
20
*/
21
/**
22
 * Two Cycle Barrel Shift Unit
23
 * @file aeMB2_bsft.v
24
 
25
 * This implements a 2 cycle barrel shifter. The design can be further
26
   optimised depending on architecture.
27
 
28
 */
29
 
30
// 420 LUTS
31
`timescale  1ns/1ps
32
module aeMB2_bsft (/*AUTOARG*/
33
   // Outputs
34
   bsf_mx,
35
   // Inputs
36
   opa_of, opb_of, opc_of, imm_of, gclk, grst, dena, gpha
37
   );
38
   parameter AEMB_BSF = 1; ///< implement barrel shift  
39
 
40
   output [31:0] bsf_mx;
41
 
42
   input [31:0]  opa_of;
43
   input [31:0]  opb_of;
44
   input [5:0]    opc_of;
45
   input [10:9]  imm_of;
46
 
47
   // SYS signals
48
   input         gclk,
49
                 grst,
50
                 dena,
51
                 gpha;
52
 
53
   /*AUTOREG*/
54
 
55
   reg [31:0]     rBSLL, rBSRL, rBSRA;
56
   reg [31:0]     rBSR;
57
   reg [10:9]    imm_ex;
58
 
59
   wire [31:0]    wOPB = opb_of;
60
   wire [31:0]    wOPA = opa_of;
61
 
62
   // STAGE-1 SHIFTERS
63
 
64
   // logical
65
   always @(posedge gclk)
66
     if (grst) begin
67
        /*AUTORESET*/
68
        // Beginning of autoreset for uninitialized flops
69
        rBSLL <= 32'h0;
70
        rBSRL <= 32'h0;
71
        // End of automatics
72
     end else if (dena) begin
73
        rBSLL <= #1 wOPA << wOPB[4:0];
74
        rBSRL <= #1 wOPA >> wOPB[4:0];
75
     end
76
 
77
   // arithmetic
78
   always @(posedge gclk)
79
     if (grst) begin
80
        /*AUTORESET*/
81
        // Beginning of autoreset for uninitialized flops
82
        rBSRA <= 32'h0;
83
        // End of automatics
84
     end else if (dena)
85
       case (wOPB[4:0])
86
         5'd00: rBSRA <= wOPA;
87
         5'd01: rBSRA <= {{(1){wOPA[31]}}, wOPA[31:1]};
88
         5'd02: rBSRA <= {{(2){wOPA[31]}}, wOPA[31:2]};
89
         5'd03: rBSRA <= {{(3){wOPA[31]}}, wOPA[31:3]};
90
         5'd04: rBSRA <= {{(4){wOPA[31]}}, wOPA[31:4]};
91
         5'd05: rBSRA <= {{(5){wOPA[31]}}, wOPA[31:5]};
92
         5'd06: rBSRA <= {{(6){wOPA[31]}}, wOPA[31:6]};
93
         5'd07: rBSRA <= {{(7){wOPA[31]}}, wOPA[31:7]};
94
         5'd08: rBSRA <= {{(8){wOPA[31]}}, wOPA[31:8]};
95
         5'd09: rBSRA <= {{(9){wOPA[31]}}, wOPA[31:9]};
96
         5'd10: rBSRA <= {{(10){wOPA[31]}}, wOPA[31:10]};
97
         5'd11: rBSRA <= {{(11){wOPA[31]}}, wOPA[31:11]};
98
         5'd12: rBSRA <= {{(12){wOPA[31]}}, wOPA[31:12]};
99
         5'd13: rBSRA <= {{(13){wOPA[31]}}, wOPA[31:13]};
100
         5'd14: rBSRA <= {{(14){wOPA[31]}}, wOPA[31:14]};
101
         5'd15: rBSRA <= {{(15){wOPA[31]}}, wOPA[31:15]};
102
         5'd16: rBSRA <= {{(16){wOPA[31]}}, wOPA[31:16]};
103
         5'd17: rBSRA <= {{(17){wOPA[31]}}, wOPA[31:17]};
104
         5'd18: rBSRA <= {{(18){wOPA[31]}}, wOPA[31:18]};
105
         5'd19: rBSRA <= {{(19){wOPA[31]}}, wOPA[31:19]};
106
         5'd20: rBSRA <= {{(20){wOPA[31]}}, wOPA[31:20]};
107
         5'd21: rBSRA <= {{(21){wOPA[31]}}, wOPA[31:21]};
108
         5'd22: rBSRA <= {{(22){wOPA[31]}}, wOPA[31:22]};
109
         5'd23: rBSRA <= {{(23){wOPA[31]}}, wOPA[31:23]};
110
         5'd24: rBSRA <= {{(24){wOPA[31]}}, wOPA[31:24]};
111
         5'd25: rBSRA <= {{(25){wOPA[31]}}, wOPA[31:25]};
112
         5'd26: rBSRA <= {{(26){wOPA[31]}}, wOPA[31:26]};
113
         5'd27: rBSRA <= {{(27){wOPA[31]}}, wOPA[31:27]};
114
         5'd28: rBSRA <= {{(28){wOPA[31]}}, wOPA[31:28]};
115
         5'd29: rBSRA <= {{(29){wOPA[31]}}, wOPA[31:29]};
116
         5'd30: rBSRA <= {{(30){wOPA[31]}}, wOPA[31:30]};
117
         5'd31: rBSRA <= {{(31){wOPA[31]}}, wOPA[31]};
118
       endcase // case (wOPB[4:0])
119
 
120
   // STAGE-2 SHIFT
121
   always @(posedge gclk)
122
     if (grst) begin
123
        /*AUTORESET*/
124
        // Beginning of autoreset for uninitialized flops
125
        imm_ex <= 2'h0;
126
        rBSR <= 32'h0;
127
        // End of automatics
128
     end else if (dena) begin
129
        case (imm_ex)
130
          2'o0: rBSR <= #1 rBSRL;
131
          2'o1: rBSR <= #1 rBSRA;
132
          2'o2: rBSR <= #1 rBSLL;
133
          default: rBSR <= #1 32'hX;
134
        endcase // case (imm_ex)
135
        imm_ex <= #1 imm_of[10:9]; // delay 1 cycle     
136
     end
137
 
138
   assign        bsf_mx = (AEMB_BSF[0]) ? rBSR : 32'hX;
139
 
140
endmodule // aeMB2_bsft
141
 
142
/*
143
 $Log: not supported by cvs2svn $
144
 Revision 1.2  2008/04/26 01:09:05  sybreon
145
 Passes basic tests. Minor documentation changes to make it compatible with iverilog pre-processor.
146
 
147
 Revision 1.1  2008/04/18 00:21:52  sybreon
148
 Initial import.
149
*/

powered by: WebSVN 2.1.0

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