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

Subversion Repositories y80e

[/] [y80e/] [trunk/] [rtl/] [alubmux.v] - Blame information for rev 9

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 b input multiplexer module                                    Rev 0.0  07/24/2011 **/
6
/**                                                                                       **/
7
/*******************************************************************************************/
8
module alubmux (addb_in, alub_in, alub_reg, af_reg_out, bc_reg_out, de_reg_out, din0_reg,
9
                din1_reg, hl_reg_out, ix_reg, iy_reg, pc_reg, sp_reg, tmp_reg);
10
 
11
  input   [7:0] din0_reg;      /* data input 0 register                                    */
12
  input   [7:0] din1_reg;      /* data input 1 register                                    */
13
  input  [15:0] af_reg_out;    /* af register output                                       */
14
  input  [15:0] bc_reg_out;    /* bc register output                                       */
15
  input  [15:0] de_reg_out;    /* de register output                                       */
16
  input  [15:0] hl_reg_out;    /* hl register output                                       */
17
  input  [15:0] ix_reg;        /* ix register output                                       */
18
  input  [15:0] iy_reg;        /* iy register output                                       */
19
  input  [15:0] pc_reg;        /* pc register output                                       */
20
  input  [15:0] sp_reg;        /* sp register output                                       */
21
  input  [15:0] tmp_reg;       /* temporary register output                                */
22
  input  [`ALUB_IDX:0] alub_reg;   /* pipelined alu input b mux control                    */
23
  output [15:0] addb_in;       /* address alu b input bus                                  */
24
  output [15:0] alub_in;       /* alu b input bus                                          */
25
 
26
  /*****************************************************************************************/
27
  /*                                                                                       */
28
  /* signal declarations                                                                   */
29
  /*                                                                                       */
30
  /*****************************************************************************************/
31
  wire [15:0] alub_in;
32
  reg  [15:0] alub_mux;
33
  reg  [15:0] alub_mux_1, alub_mux_2, alub_mux_3, alub_mux_4, alub_mux_5;
34
  reg  [15:0] alub_mux_6, alub_mux_7, alub_mux_8, alub_mux_9, alub_mux_10, alub_mux_11;
35
 
36
  wire [15:0] addb_in;
37
  wire [15:0] addb_mux_2, addb_mux_3, addb_mux_4, addb_mux_5, addb_mux_6, addb_mux_7;
38
  wire [15:0] addb_mux_8, addb_mux_9, addb_mux_10, addb_mux_12;
39
 
40
  /*****************************************************************************************/
41
  /*                                                                                       */
42
  /* alu input b select                                                                    */
43
  /*                                                                                       */
44
  /*****************************************************************************************/
45
   always @ (alub_reg or af_reg_out or bc_reg_out or de_reg_out or hl_reg_out or ix_reg or
46
             iy_reg or sp_reg or din1_reg or din0_reg or tmp_reg or pc_reg) begin
47
    alub_mux_1  = 32'h0;
48
    alub_mux_2  = 32'h0;
49
    alub_mux_3  = 32'h0;
50
    alub_mux_4  = 32'h0;
51
    alub_mux_5  = 32'h0;
52
    alub_mux_6  = 32'h0;
53
    alub_mux_7  = 32'h0;
54
    alub_mux_8  = 32'h0;
55
    alub_mux_9  = 32'h0;
56
    alub_mux_10 = 32'h0;
57
    alub_mux_11 = 32'h0;
58
    if (alub_reg[`AB_AF])  alub_mux_1  = af_reg_out;
59
    if (alub_reg[`AB_BC])  alub_mux_2  = bc_reg_out;
60
    if (alub_reg[`AB_DE])  alub_mux_3  = de_reg_out;
61
    if (alub_reg[`AB_HL])  alub_mux_4  = hl_reg_out;
62
    if (alub_reg[`AB_IX])  alub_mux_5  = ix_reg;
63
    if (alub_reg[`AB_IY])  alub_mux_6  = iy_reg;
64
    if (alub_reg[`AB_SP])  alub_mux_7  = sp_reg;
65
    if (alub_reg[`AB_DIN]) alub_mux_8  = {din1_reg, din0_reg};
66
    if (alub_reg[`AB_IO])  alub_mux_9  = {af_reg_out[15:8], din0_reg};
67
    if (alub_reg[`AB_TMP]) alub_mux_10 =  tmp_reg;
68
    if (alub_reg[`AB_PC])  alub_mux_11 = pc_reg;
69
    end
70
 
71
  always @ (alub_mux_1 or alub_mux_2 or alub_mux_3 or alub_mux_4 or alub_mux_5 or
72
            alub_mux_6 or alub_mux_7 or alub_mux_8 or alub_mux_9 or alub_mux_10 or
73
            alub_mux_11) begin
74
    alub_mux = alub_mux_1 | alub_mux_2 | alub_mux_3 | alub_mux_4 | alub_mux_5 |
75
               alub_mux_6 | alub_mux_7 | alub_mux_8 | alub_mux_9 | alub_mux_10 | alub_mux_11;
76
    end
77
 
78
  assign alub_in  = (alub_reg[`AB_SHR]) ? {alub_mux[15:8], alub_mux[15:8]} : alub_mux;
79
 
80
  /*****************************************************************************************/
81
  /*                                                                                       */
82
  /* address alu input b select                                                            */
83
  /*                                                                                       */
84
  /*****************************************************************************************/
85
  assign addb_mux_2  = (alub_reg[`AB_BC])  ? bc_reg_out                   : 16'h0;
86
  assign addb_mux_3  = (alub_reg[`AB_DE])  ? de_reg_out                   : 16'h0;
87
  assign addb_mux_4  = (alub_reg[`AB_HL])  ? hl_reg_out                   : 16'h0;
88
  assign addb_mux_5  = (alub_reg[`AB_IX])  ? ix_reg                       : 16'h0;
89
  assign addb_mux_6  = (alub_reg[`AB_IY])  ? iy_reg                       : 16'h0;
90
  assign addb_mux_7  = (alub_reg[`AB_SP])  ? sp_reg                       : 16'h0;
91
  assign addb_mux_8  = (alub_reg[`AB_DIN]) ? {din1_reg, din0_reg}         : 16'h0;
92
  assign addb_mux_9  = (alub_reg[`AB_IO])  ? {af_reg_out[15:8], din0_reg} : 16'h0;
93
  assign addb_mux_10 = (alub_reg[`AB_TMP]) ? tmp_reg                      : 16'h0;
94
  assign addb_mux_12 = (alub_reg[`AB_ADR]) ? pc_reg                       : 16'h0;
95
 
96
  assign addb_in =  addb_mux_2 | addb_mux_3 | addb_mux_4 | addb_mux_5  | addb_mux_6 |
97
                    addb_mux_7  | addb_mux_8 |addb_mux_9 | addb_mux_10 | addb_mux_12;
98
 
99
  endmodule
100
 
101
 
102
 
103
 
104
 

powered by: WebSVN 2.1.0

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