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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [Projects/] [opencores.org/] [Mos6502/] [ip/] [core/] [rtl/] [verilog/] [alu_logic] - Blame information for rev 131

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 131 jt_eaton
 
2
module `VARIANT`ALU_LOGIC
3
 
4
(
5
 
6
 
7
 
8
input wire [7:0] alu_op_a,
9
input wire [7:0] alu_op_b,
10
input wire       alu_op_c,
11
 
12
input wire       alu_op_b_inv,
13
 
14
 
15
output reg [7:0]   result,
16
output reg       r_result,
17
output reg       c_result,
18
output reg       v_result,
19
 
20
output reg [7:0]   and_out,
21
output reg [7:0]   orr_out,
22
output reg [7:0]   eor_out,
23
 
24
 
25
output reg [8:0]   a_sh_left,
26
output reg [8:0]   a_sh_right,
27
output reg [8:0]   b_sh_left,
28
output reg [8:0]   b_sh_right
29
 
30
 
31
 
32
);
33
 
34
 
35
reg [7:0] alu_op_b_mod;
36
 
37
always@(*)
38
  begin
39
  alu_op_b_mod  =    alu_op_b_inv  ? ~alu_op_b  : alu_op_b;
40
  end
41
 
42
 
43
always@(*)
44
  begin
45
 
46
  c_result      =    alu_op_b_inv  ? !r_result  : r_result;
47
  v_result      =  ((alu_op_a[7] == alu_op_b[7]) && (alu_op_a[7] != result[7]));
48
  end
49
 
50
 
51
 
52
always @ (*)
53
        begin
54
          {r_result,result[7:0]} =  alu_op_a + alu_op_b_mod + {7'b0,alu_op_c};
55
       end
56
 
57
 
58
always @ (*)
59
           begin
60
           a_sh_left   = {alu_op_a, alu_op_c};
61
           a_sh_right  = {alu_op_a[0],alu_op_c, alu_op_a[7:1]};
62
           b_sh_left   = {alu_op_b, alu_op_c};
63
           b_sh_right  = {alu_op_b[0],alu_op_c, alu_op_b[7:1]};
64
           and_out     =  alu_op_a & alu_op_b;
65
           orr_out     =  alu_op_a | alu_op_b;
66
           eor_out     =  alu_op_a ^ alu_op_b;
67
           end
68
 
69
 
70
endmodule

powered by: WebSVN 2.1.0

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