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

Subversion Repositories y80e

[/] [y80e/] [trunk/] [rtl/] [alu_log.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 logic module                                                  Rev 0.0  07/17/2011 **/
6
/**                                                                                       **/
7
/*******************************************************************************************/
8
module alu_log  (logic_c, logic_hc, logic_out, alua_in, alub_in, aluop_reg, carry_bit);
9
 
10
  input         carry_bit;     /* cpu carry flag                                           */
11
  input  [15:0] alua_in;       /* alu a input                                              */
12
  input  [15:0] alub_in;       /* alu b input                                              */
13
  input  [`AOP_IDX:0] aluop_reg;   /* alu operation control                                */
14
  output        logic_c;       /* alu logic carry result                                   */
15
  output        logic_hc;      /* alu logic half-carry result                              */
16
  output [15:0] logic_out;     /* alu logic result                                         */
17
 
18
  /*****************************************************************************************/
19
  /*                                                                                       */
20
  /* signal declarations                                                                   */
21
  /*                                                                                       */
22
  /*****************************************************************************************/
23
  reg         logic_c;                                     /* logic carry output           */
24
  reg         logic_hc;                                    /* logic half-carry output      */
25
  reg  [15:0] logic_out;                                   /* logic output                 */
26
 
27
  /*****************************************************************************************/
28
  /*                                                                                       */
29
  /* alu logic function                                                                    */
30
  /*                                                                                       */
31
  /*****************************************************************************************/
32
  always @ (aluop_reg or carry_bit) begin
33
    casex (aluop_reg)
34
      `AOP_CCF:   logic_c = !carry_bit;
35
      `AOP_SCF:   logic_c = 1'b1;
36
      default:    logic_c = 1'b0;
37
      endcase
38
    end
39
 
40
  always @ (aluop_reg or carry_bit) begin
41
    casex (aluop_reg)
42
      `AOP_BAND:  logic_hc = 1'b1;
43
      `AOP_CCF:   logic_hc = carry_bit;
44
      default:    logic_hc = 1'b0;
45
      endcase
46
    end
47
 
48
  always @ (aluop_reg or alua_in or alub_in) begin
49
    casex (aluop_reg)
50
      `AOP_BAND:  logic_out = {8'h00, alua_in[7:0] & alub_in[7:0]};
51
      `AOP_BOR:   logic_out = {8'h00, alua_in[7:0] | alub_in[7:0]};
52
      `AOP_BXOR:  logic_out = {8'h00, alua_in[7:0] ^ alub_in[7:0]};
53
      `AOP_RLD1:  logic_out = {8'h00, alub_in[3:0],  alua_in[3:0]};
54
      `AOP_RLD2:  logic_out = {8'h00, alua_in[7:4],  alub_in[7:4]};
55
      `AOP_RRD1:  logic_out = {8'h00, alua_in[3:0],  alub_in[7:4]};
56
      `AOP_RRD2:  logic_out = {8'h00, alua_in[7:4],  alub_in[3:0]};
57
      `AOP_APAS:  logic_out = alua_in;
58
      `AOP_PASS:  logic_out = alub_in;
59
      default:    logic_out = 16'h0000;
60
      endcase
61
    end
62
 
63
  endmodule
64
 
65
 
66
 
67
 
68
 

powered by: WebSVN 2.1.0

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