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

Subversion Repositories natalius_8bit_risc

[/] [natalius_8bit_risc/] [trunk/] [processor_core/] [ALU.v] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 fabioandre
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3
// Company: 
4
// Engineer: 
5
// 
6
// Create Date:    19:05:06 05/02/2012 
7
// Design Name: 
8
// Module Name:    ALU 
9
// Project Name: 
10
// Target Devices: 
11
// Tool versions: 
12
// Description: 
13
//
14
// Dependencies: 
15
//
16
// Revision: 
17
// Revision 0.01 - File Created
18
// Additional Comments: 
19
//
20
//////////////////////////////////////////////////////////////////////////////////
21
module ALU(
22
    input [7:0] a,
23
    input [7:0] b,
24
    output [7:0] result,
25
    input [2:0] opalu,
26
         output zero, carry
27
    );
28
 
29
reg [7:0] resu;
30
 
31
always@*
32
        case (opalu)
33
                0: resu <= ~a;
34
                1: resu <= a & b;
35
                2: resu <= a ^ b;
36
                3: resu <= a | b;
37
                4: resu <= a;
38
                5: resu <= a + b;
39
                6: resu <= a - b;
40
                default: resu <= a + 1;
41
        endcase
42
 
43
assign zero=(resu==0);
44
assign result=resu;
45
assign carry=(a<b);
46
 
47
 
48
endmodule
49
 

powered by: WebSVN 2.1.0

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