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

Subversion Repositories edge

[/] [edge/] [trunk/] [HW/] [Verilog/] [shifter_decoder.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 heshamelma
//////////////////////////////////////////////////////////////////
2
//                                                              //
3
//  Shift decoder for Edge Core                                 //       
4
//                                                              //
5
//  This file is part of the Edge project                       //
6
//  http://www.opencores.org/project,edge                       //
7
//                                                              //
8
//  Description                                                 //
9
//  Shift decoder is part of the main controller/decoder at     //
10
//  decode stage. It decodes MIPS instruction and produces      //
11
//  control signals for the shift unit.
12
//                                                              //
13
//  Author(s):                                                  //
14
//      - Hesham AL-Matary, heshamelmatary@gmail.com            //
15
//                                                              //
16
//////////////////////////////////////////////////////////////////
17
//                                                              //
18
// Copyright (C) 2014 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
/* Shift unit control */
44
`define SLL_CTRL                2'b00
45
`define SRL_CTRL                2'b01
46
`define SRA_CTRL                2'b10
47
 
48
/* Shift Encoding */
49
`define SLL_FUNCT               6'b000000 // 0 
50
`define SRL_FUNCT               6'b000010 // 2
51
`define SRA_FUNCT               6'b000011 // 3
52
`define SLLV_FUNCT      6'b000100 // 4
53
`define SRLV_FUNCT      6'b000110 // 6
54
`define SRAV_FUNCT      6'b000111 // 7
55
 
56
module shifter_decoder
57
(
58
  input[5:0] Funct,
59
 
60
  output reg ShiftAmtVar_out,
61
  output reg[1:0] Shift_type
62
);
63
 
64
always @*
65
begin
66
  ShiftAmtVar_out = 1'b0;
67
  Shift_type <= 2'b00;
68
 
69
  case (Funct)
70
    `SLL_FUNCT : Shift_type <= `SLL_CTRL;
71
    `SLLV_FUNCT :
72
      begin
73
        Shift_type <= `SLL_CTRL;
74
        ShiftAmtVar_out = 1'b1;
75
      end
76
    `SRL_FUNCT : Shift_type <= `SRL_CTRL;
77
    `SRLV_FUNCT :
78
      begin
79
        Shift_type <= `SRL_CTRL;
80
        ShiftAmtVar_out = 1'b1;
81
      end
82
    `SRA_FUNCT : Shift_type <= `SRA_CTRL;
83
    `SRAV_FUNCT :
84
      begin
85
        Shift_type <= `SRA_CTRL;
86
        ShiftAmtVar_out = 1'b1;
87
      end
88
 
89
  endcase
90
end
91
 
92
endmodule

powered by: WebSVN 2.1.0

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