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

Subversion Repositories fwrisc

[/] [fwrisc/] [trunk/] [rtl/] [fwrisc_comparator.sv] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mballance
/****************************************************************************
2
 * fwrisc_comparator.sv
3
 *
4
 * Copyright 2018 Matthew Ballance
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the
7
 * "License"); you may not use this file except in
8
 * compliance with the License.  You may obtain a copy of
9
 * the License at
10
 *
11
 * http://www.apache.org/licenses/LICENSE-2.0
12
 *
13
 * Unless required by applicable law or agreed to in
14
 * writing, software distributed under the License is
15
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
16
 * CONDITIONS OF ANY KIND, either express or implied.  See
17
 * the License for the specific language governing
18
 * permissions and limitations under the License.
19
 ****************************************************************************/
20
 
21
`include "fwrisc_defines.vh"
22
 
23
/**
24
 * Module: fwrisc_comparator
25
 *
26
 * TODO: Add module documentation
27
 */
28
module fwrisc_comparator(
29
                input                   clock,
30
                input                   reset,
31
                input[31:0]             in_a,
32
                input[31:0]             in_b,
33
                input[1:0]              op,
34
                output reg              out
35
                );
36
 
37
        always @* begin
38
                case (op)
39
                        `COMPARE_EQ: out = (in_a == in_b);
40
                        `COMPARE_LT: out = ($signed(in_a) < $signed(in_b));
41
                        default: /*COMPARE_LTU:*/ out = (in_a < in_b);
42
                endcase
43
        end
44
 
45
endmodule
46
 
47
 

powered by: WebSVN 2.1.0

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