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

Subversion Repositories 8051

[/] [8051/] [trunk/] [rtl/] [verilog/] [oc8051_comp.v] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 simont
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  8051 compare                                                ////
4
////                                                              ////
5
////  This file is part of the 8051 cores project                 ////
6
////  http://www.opencores.org/cores/8051/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////   compares selected inputs and set eq to 1 if they are equal ////
10
////   Is used for conditional jumps.                             ////
11
////                                                              ////
12
////  To Do:                                                      ////
13
////   nothing                                                    ////
14
////                                                              ////
15
////  Author(s):                                                  ////
16
////      - Simon Teran, simont@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
// ver: 1
46
//
47
 
48
// synopsys translate_off
49
`include "oc8051_timescale.v"
50
// synopsys translate_on
51
 
52
`include "oc8051_defines.v"
53
 
54
 
55
module oc8051_comp (sel, b_in, cy, acc, ram, op2, des, eq);
56
//
57
// sel          (in)  select whithc sourses to compare (look defines.v) [oc8051_decoder.comp_sel]
58
// b_in         (in)  bit in - output from bit addressable memory space [oc8051_ram_sel.bit_out]
59
// cy           (in)  carry flag [oc8051_psw.data_out[7] ]
60
// acc          (in)  accumulator [oc8051_acc.data_out]
61
// ram          (in)  input from ram [oc8051_ram_sel.out_data]
62
// op2          (in)  immediate data [oc8051_op_select.op2_out -r]
63
// des          (in)  destination from alu [oc8051_alu.des1 -r]
64
// eq           (out) if (src1 == src2) eq = 1  [oc8051_decoder.eq]
65
//
66
 
67
 
68
input [2:0] sel;
69
input b_in, cy;
70
input [7:0] acc, ram, op2, des;
71
 
72
output eq;
73
reg eq;
74
 
75
always @(sel or b_in or cy or acc or ram or op2 or des)
76
begin
77
  case (sel)
78
    `OC8051_CSS_AZ : eq = (acc == 8'h00);
79
    `OC8051_CSS_AR : eq = (acc == ram);
80
    `OC8051_CSS_AC : eq = (acc == op2);
81
    `OC8051_CSS_CR : eq = (op2 == ram);
82
    `OC8051_CSS_DES : eq = (des == 8'h00);
83
    `OC8051_CSS_CY : eq = cy;
84
    `OC8051_CSS_BIT : eq = b_in;
85
    default: eq = 1'bx;
86
  endcase
87
end
88
 
89
endmodule

powered by: WebSVN 2.1.0

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