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

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [rtl/] [8051/] [oc8051_alu_src_sel.v] - Blame information for rev 12

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

Line No. Rev Author Line
1 2 dinesha
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  8051 alu source select module                               ////
4
////                                                              ////
5
////  This file is part of the 8051 cores project                 ////
6
////  http://www.opencores.org/cores/oms8051mini/                 ////
7
////                                                              ////
8
////  Description                                                 ////
9
////   Multiplexer wiht whitch we select data on alu sources      ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////   nothing                                                    ////
13
////                                                              ////
14
////  Author(s):                                                  ////
15
////      - Simon Teran, simont@opencores.org                     ////
16
////      - Dinesh Annayya, dinesha@opencores.org                 ////
17
////                                                              ////
18
//////////////////////////////////////////////////////////////////////
19
////                                                              ////
20
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
21
////                                                              ////
22
//// This source file may be used and distributed without         ////
23
//// restriction provided that this copyright statement is not    ////
24
//// removed from the file and that any derivative work contains  ////
25
//// the original copyright notice and the associated disclaimer. ////
26
////                                                              ////
27
//// This source file is free software; you can redistribute it   ////
28
//// and/or modify it under the terms of the GNU Lesser General   ////
29
//// Public License as published by the Free Software Foundation; ////
30
//// either version 2.1 of the License, or (at your option) any   ////
31
//// later version.                                               ////
32
////                                                              ////
33
//// This source is distributed in the hope that it will be       ////
34
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
35
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
36
//// PURPOSE.  See the GNU Lesser General Public License for more ////
37
//// details.                                                     ////
38
////                                                              ////
39
//// You should have received a copy of the GNU Lesser General    ////
40
//// Public License along with this source; if not, download it   ////
41
//// from http://www.opencores.org/lgpl.shtml                     ////
42
////                                                              ////
43
//////////////////////////////////////////////////////////////////////
44
//
45
// CVS Revision History
46
//
47
// $Log: not supported by cvs2svn $
48
// Revision 1.3  2003/06/03 17:13:57  simont
49
// remove pc_r register.
50
//
51
// Revision 1.2  2003/05/06 09:41:35  simont
52
// remove define OC8051_AS2_PCL, chane signal src_sel2 to 2 bit wide.
53
//
54
// Revision 1.1  2003/01/13 14:13:12  simont
55
// initial import
56
//
57
//
58
//
59
 
60
`include "top_defines.v"
61
 
62
 
63
module oc8051_alu_src_sel (clk, rst, rd, sel1, sel2, sel3,
64
                     acc, ram, pc, dptr,
65
 
66
                     op1, op2, op3,
67
 
68
                     src1, src2, src3);
69
 
70
 
71
input clk, rst, rd, sel3;
72
input [1:0] sel2;
73
input [2:0] sel1;
74
input [7:0] acc, ram;
75
input [15:0] dptr;
76
input [15:0] pc;
77
 
78
 
79
input [7:0] op1, op2, op3;
80
 
81
output [7:0] src1, src2, src3;
82
 
83
reg [7:0] src1, src2, src3;
84
 
85
reg [7:0] op1_r, op2_r, op3_r;
86
 
87
///////
88
//
89
// src1
90
//
91
///////
92
always @(sel1 or op1_r or op2_r or op3_r or pc or acc or ram)
93
begin
94
  case (sel1) /* synopsys full_case parallel_case */
95
    `OC8051_AS1_RAM: src1 = ram;
96
    `OC8051_AS1_ACC: src1 = acc;
97
    `OC8051_AS1_OP1: src1 = op1_r;
98
    `OC8051_AS1_OP2: src1 = op2_r;
99
    `OC8051_AS1_OP3: src1 = op3_r;
100
    `OC8051_AS1_PCH: src1 = pc[15:8];
101
    `OC8051_AS1_PCL: src1 = pc[7:0];
102
//    default: src1 = 8'h00;
103
  endcase
104
end
105
 
106
///////
107
//
108
// src2
109
//
110
///////
111
always @(sel2 or op2_r or acc or ram or op1_r)
112
begin
113
  case (sel2) /* synopsys full_case parallel_case */
114
    `OC8051_AS2_ACC: src2= acc;
115
    `OC8051_AS2_ZERO: src2= 8'h00;
116
    `OC8051_AS2_RAM: src2= ram;
117
    `OC8051_AS2_OP2: src2= op2_r;
118
//    default: src2= 8'h00;
119
  endcase
120
end
121
 
122
///////
123
//
124
// src3
125
//
126
///////
127
 
128
always @(sel3 or pc[15:8] or dptr[15:8] or op1_r)
129
begin
130
  case (sel3) /* synopsys full_case parallel_case */
131
    `OC8051_AS3_DP:   src3= dptr[15:8];
132
    `OC8051_AS3_PC:   src3= pc[15:8];
133
//    default: src3= 16'h0;
134
  endcase
135
end
136
 
137
 
138
always @(posedge clk or posedge rst)
139
  if (rst) begin
140
    op1_r <= #1 8'h00;
141
    op2_r <= #1 8'h00;
142
    op3_r <= #1 8'h00;
143
  end else begin
144
    op1_r <= #1 op1;
145
    op2_r <= #1 op2;
146
    op3_r <= #1 op3;
147
  end
148
 
149
endmodule

powered by: WebSVN 2.1.0

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