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

Subversion Repositories ecpu_alu

[/] [ecpu_alu/] [trunk/] [alu/] [rtl/] [verilog/] [alu.v] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 leonous
// port from university ALU VHDL project
2
//
3
// ECPU ALU version 0.1.alpha
4
module alu (A, B, S, Y, CLR, CLK, C, V, Z);
5
 
6
  parameter DWIDTH  = 16;
7
  parameter OPWIDTH =  4;
8
 
9
        input     [(DWIDTH -1):0]  A     ;
10
        input   [(DWIDTH -1):0]  B     ;
11
        input   [(OPWIDTH-1):0]  S     ;
12
        output  [(DWIDTH -1):0]  Y     ;
13
        input                    CLR   ;
14
        input                      CLK   ;
15
        output                   C     ;
16
        output                   V     ;
17
        output                   Z     ;
18
 
19
  wire                                             add_AB        ;
20
  wire                                             inc_A         ;
21
  wire                                             inc_B         ;
22
  wire                                             sub_AB        ;
23
  wire                                             cmp_AB        ;
24
  wire                                             sl_AB         ;
25
  wire                                             sr_AB         ;
26
  wire                                             clr_ALL       ;
27
  wire                                             dec_A         ;
28
  wire                                             dec_B         ;
29
  wire                                             mul_AB        ;
30
  wire                                             cpl_A         ;
31
  wire                                             and_AB        ;
32
  wire                                             or_AB         ;
33
  wire                                             xor_AB        ;
34
  wire                                             cpl_B         ;
35
 
36
  wire                                             clr_Z          ;
37
  wire                                             clr_V          ;
38
  wire                                             clr_C          ;
39
 
40
  wire                                             reset          ;
41
  wire                                             load_inputs    ;
42
  wire                                             load_outputs   ;
43
 
44
  `ifdef ADD_VERSION
45
    wire                   VERSION        ;
46
    assign VERSION = "0.1.alpha";
47
  `endif
48
 
49
        // clear is the same as reset
50
        assign reset    =       CLR;
51
 
52
  // controller instance
53
        alu_controller #(OPWIDTH) controller     (
54
                                            add_AB      ,
55
                                            inc_A       ,
56
                                            inc_B       ,
57
                                            sub_AB      ,
58
                                            cmp_AB      ,
59
                                            sl_AB       ,
60
                                            sr_AB       ,
61
                                            clr_ALL     ,
62
                                            dec_A       ,
63
                                            dec_B       ,
64
                                            mul_AB      ,
65
                                            cpl_A       ,
66
                                            and_AB      ,
67
                                            or_AB       ,
68
                                            xor_AB      ,
69
                                            cpl_B       ,
70
 
71
                                            clr_Z                   ,
72
                                            clr_V                   ,
73
                                            clr_C                   ,
74
 
75
                                            load_inputs ,
76
                                            load_outputs,
77
 
78
                                            S                         ,
79
 
80
                                            reset                   ,
81
                                            CLK
82
                                                                        );
83
 
84
  // datapath instance                              
85
        alu_datapath #(DWIDTH) datapath         (
86
                                                                          A                             ,
87
                                                                          B                             ,
88
                                                                          Y                             ,
89
 
90
                                                                          add_AB        ,
91
                                                                          inc_A         ,
92
                                                                          inc_B         ,
93
                                                                          sub_AB        ,
94
                                                                          cmp_AB        ,
95
                                                                          sl_AB         ,
96
                                                                          sr_AB         ,
97
                                                                          clr_ALL       ,
98
                                                                          dec_A         ,
99
                                                                          dec_B         ,
100
                                                                          mul_AB        ,
101
                                                                          cpl_A         ,
102
                                                                          and_AB        ,
103
                                                                          or_AB         ,
104
                                                                          xor_AB        ,
105
                                            cpl_B         ,
106
 
107
                                                                          clr_Z               ,
108
                                                                          clr_V               ,
109
                                                                          clr_C               ,
110
 
111
                                                                          C                             ,
112
                                                                          V                             ,
113
                                                                          Z                             ,
114
 
115
                                                                          load_inputs     ,
116
                                                                          load_outputs  ,
117
 
118
                                                                          reset         ,
119
 
120
                                                                          CLK
121
                                                                        );
122
endmodule

powered by: WebSVN 2.1.0

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