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

Subversion Repositories y80e

[/] [y80e/] [trunk/] [rtl/] [aluout.v] - Blame information for rev 5

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 bsa
/*******************************************************************************************/
2
/**                                                                                       **/
3
/** COPYRIGHT (C) 2011, SYSTEMYDE INTERNATIONAL CORPORATION, ALL RIGHTS RESERVED          **/
4
/**                                                                                       **/
5
/** alu function unit combiner module                                 Rev 0.0  07/24/2011 **/
6
/**                                                                                       **/
7
/*******************************************************************************************/
8
module aluout (cry_nxt, data_bus, hcar_nxt, one_nxt, par_nxt, sign_nxt, zero_nxt, adder_c,
9
               adder_hc, adder_out, hi_byte, logic_c, logic_hc, logic_out, shft_c, shft_out,
10
               unit_sel, word_op);
11
 
12
  input         adder_c;       /* math carry result                                        */
13
  input         adder_hc;      /* math half-carry result                                   */
14
  input         hi_byte;       /* shift left byte control                                  */
15
  input         logic_c;       /* logic carry result                                       */
16
  input         logic_hc;      /* logic half-carry result                                  */
17
  input         shft_c;        /* shift carry result                                       */
18
  input         word_op;       /* word operation                                           */
19
  input   [1:0] unit_sel;      /* alu function unit select                                 */
20
  input   [7:0] shft_out;      /* shift unit result                                        */
21
  input  [15:0] adder_out;     /* math unit result                                         */
22
  input  [15:0] logic_out;     /* logic unit result                                        */
23
  output        cry_nxt;       /* carry flag next                                          */
24
  output        hcar_nxt;      /* half-carry flag next                                     */
25
  output        one_nxt;       /* one flag next                                            */
26
  output        par_nxt;       /* parity flag next                                         */
27
  output        sign_nxt;      /* sign flag next                                           */
28
  output        zero_nxt;      /* zero flag next                                           */
29
  output [15:0] data_bus;      /* datapath data bus                                        */
30
 
31
  /*****************************************************************************************/
32
  /*                                                                                       */
33
  /* signal declarations                                                                   */
34
  /*                                                                                       */
35
  /*****************************************************************************************/
36
  wire        one_nxt, par_nxt, sign_nxt, zero_nxt;
37
  wire [15:0] data_bus;
38
 
39
  reg         cry_nxt, hcar_nxt;
40
  reg  [15:0] alu_result;
41
 
42
  /*****************************************************************************************/
43
  /*                                                                                       */
44
  /* alu function unit combination                                                         */
45
  /*                                                                                       */
46
  /*****************************************************************************************/
47
  always @ (unit_sel or adder_out or logic_out or shft_out) begin
48
    casex (unit_sel)
49
      2'b01:   alu_result = adder_out;
50
      2'b1x:   alu_result = {8'h00, shft_out};
51
      default: alu_result = logic_out;
52
      endcase
53
    end
54
 
55
  /*****************************************************************************************/
56
  /*                                                                                       */
57
  /* alu flag outputs                                                                      */
58
  /*                                                                                       */
59
  /*****************************************************************************************/
60
  always @ (unit_sel or adder_c or logic_c or shft_c) begin
61
    casex (unit_sel)
62
      2'b01:   cry_nxt = adder_c;
63
      2'b1x:   cry_nxt = shft_c;
64
      default: cry_nxt = logic_c;
65
      endcase
66
    end
67
 
68
  always @ (unit_sel or adder_hc or logic_hc) begin
69
    casex (unit_sel)
70
      2'b01:   hcar_nxt = adder_hc;
71
      2'b1x:   hcar_nxt = 1'b0;
72
      default: hcar_nxt = logic_hc;
73
      endcase
74
    end
75
 
76
  assign one_nxt  = ~|alu_result[7:1] && alu_result[0];
77
  assign par_nxt  = ~^alu_result[7:0];
78
  assign sign_nxt = (word_op) ?   alu_result[15]   :   alu_result[7];
79
  assign zero_nxt = (word_op) ? ~|alu_result[15:0] : ~|alu_result[7:0];
80
 
81
  /*****************************************************************************************/
82
  /*                                                                                       */
83
  /* alu output left shift                                                                 */
84
  /*                                                                                       */
85
  /*****************************************************************************************/
86
  assign data_bus = (hi_byte) ? {alu_result[7:0], alu_result[7:0]} : alu_result[15:0];
87
 
88
  endmodule
89
 
90
 
91
 
92
 
93
 
94
 

powered by: WebSVN 2.1.0

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