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

Subversion Repositories quark

[/] [quark/] [trunk/] [05_HDLConstruction/] [01_OldArchitecture_ReferenceOnly/] [Alu/] [Alu.v] - Blame information for rev 9

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

Line No. Rev Author Line
1 3 progman32
////////////////////////////////////////////////
2
// @file  ALU.v
3
// @brief ALU design for Quantum processor
4
// @date  9/6/2014
5
////////////////////////////////////////////////
6
 
7
`include "Alu.vh"
8
 
9
module ModAlu (
10
  input             Clock,
11
  input             Reset,
12
  input      [0:7]  AluInstruction,
13
  input      [0:7]  AluInput1,
14
  input      [0:7]  AluInput2,
15
  output reg [0:15] AluResult
16
  );
17
 
18
  always@(posedge Clock, negedge Reset) begin
19
    if (Reset == 1'b0) begin
20
      AluResult <= 16'h00;
21
    end else begin
22
      case (AluInstruction)
23
        `Idle: begin
24
          AluResult <= AluResult;
25
        end
26
        `And: begin
27
          AluResult <= AluInput2 & AluInput1;
28
        end
29
        `Or: begin
30
          AluResult <= AluInput2 | AluInput1;
31
        end
32
        `XNOr: begin
33
          AluResult <= AluInput2 ^~ AluInput1;
34
        end
35
        `XOr: begin
36
          AluResult <= AluInput2 ^ AluInput1;
37
        end
38
        `Not: begin
39
          AluResult <= {AluInput2, AluInput1};
40
        end
41
        `Add: begin
42
          AluResult <= AluInput2 + AluInput1;
43
        end
44
        `Sub: begin
45
          AluResult <= AluInput2 - AluInput1;
46
        end
47
        default: begin
48
          AluResult <= AluResult;
49
        end
50
      endcase
51
    end
52
  end
53
endmodule
54
 
55
////////////////////////////////////////////////
56
// EOF
57
////////////////////////////////////////////////

powered by: WebSVN 2.1.0

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