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

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [rtl/] [8051/] [oc8051_alu_test.v] - Diff between revs 2 and 25

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 25
Line 16... Line 16...
//// Author(s):                                                   ////
//// Author(s):                                                   ////
////      - Simon Teran, simont@opencores.org                     ////
////      - Simon Teran, simont@opencores.org                     ////
////      - Dinesh Annayya, dinesha@opencores.org                 ////
////      - Dinesh Annayya, dinesha@opencores.org                 ////
////                                                              ////
////                                                              ////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
 
////   v0.0 - Dinesh A, 5th Jan 2017
 
////        1. Active edge of reset changed from High to Low
 
//////////////////////////////////////////////////////////////////////
////                                                              ////
////                                                              ////
//// Copyright (C) 2001 Authors and OPENCORES.ORG                 ////
//// Copyright (C) 2001 Authors and OPENCORES.ORG                 ////
////                                                              ////
////                                                              ////
//// This source file may be used and distributed without         ////
//// This source file may be used and distributed without         ////
//// restriction provided that this copyright statement is not    ////
//// restriction provided that this copyright statement is not    ////
Line 54... Line 57...
 
 
`include "top_defines.v"
`include "top_defines.v"
 
 
 
 
 
 
module oc8051_alu (clk, rst, op_code, src1, src2, src3, srcCy, srcAc, bit_in, des1, des2, des1_r, desCy, desAc, desOv);
module oc8051_alu (clk, resetn, op_code, src1, src2, src3, srcCy, srcAc, bit_in, des1, des2, des1_r, desCy, desAc, desOv);
//
//
// op_code      (in)  operation code [oc8051_decoder.alu_op -r]
// op_code      (in)  operation code [oc8051_decoder.alu_op -r]
// src1         (in)  first operand [oc8051_alu_src1_sel.des]
// src1         (in)  first operand [oc8051_alu_src1_sel.des]
// src2         (in)  second operand [oc8051_alu_src2_sel.des]
// src2         (in)  second operand [oc8051_alu_src2_sel.des]
// src3         (in)  third operand [oc8051_alu_src3_sel.des]
// src3         (in)  third operand [oc8051_alu_src3_sel.des]
Line 71... Line 74...
// desCy        (out) carry output [oc8051_ram_top.bit_data_in, oc8051_acc.bit_in, oc8051_b_register.bit_in, oc8051_psw.cy_in, oc8051_ports.bit_in]
// desCy        (out) carry output [oc8051_ram_top.bit_data_in, oc8051_acc.bit_in, oc8051_b_register.bit_in, oc8051_psw.cy_in, oc8051_ports.bit_in]
// desAc        (out) auxiliary carry output [oc8051_psw.ac_in]
// desAc        (out) auxiliary carry output [oc8051_psw.ac_in]
// desOv        (out) Overflow output [oc8051_psw.ov_in]
// desOv        (out) Overflow output [oc8051_psw.ov_in]
//
//
 
 
input srcCy, srcAc, bit_in, clk, rst; input [3:0] op_code; input [7:0] src1, src2, src3;
input srcCy, srcAc, bit_in, clk, resetn; input [3:0] op_code; input [7:0] src1, src2, src3;
output desCy, desAc, desOv;
output desCy, desAc, desOv;
output [7:0] des1, des2;
output [7:0] des1, des2;
output [7:0] des1_r;
output [7:0] des1_r;
 
 
reg desCy, desAc, desOv;
reg desCy, desAc, desOv;
Line 121... Line 124...
//da
//da
//
//
reg da_tmp;
reg da_tmp;
//reg [8:0] da1;
//reg [8:0] da1;
 
 
oc8051_multiply oc8051_mul1(.clk(clk), .rst(rst), .enable(enable_mul), .src1(src1), .src2(src2), .des1(mulsrc1), .des2(mulsrc2), .desOv(mulOv));
oc8051_multiply oc8051_mul1(.clk(clk), .resetn(resetn), .enable(enable_mul), .src1(src1), .src2(src2), .des1(mulsrc1), .des2(mulsrc2), .desOv(mulOv));
oc8051_divide oc8051_div1(.clk(clk), .rst(rst), .enable(enable_div), .src1(src1), .src2(src2), .des1(divsrc1), .des2(divsrc2), .desOv(divOv));
oc8051_divide oc8051_div1(.clk(clk), .resetn(resetn), .enable(enable_div), .src1(src1), .src2(src2), .des1(divsrc1), .des2(divsrc2), .desOv(divOv));
 
 
/* Add */
/* Add */
assign add1 = {1'b0,src1[3:0]};
assign add1 = {1'b0,src1[3:0]};
assign add2 = {1'b0,src2[3:0]};
assign add2 = {1'b0,src2[3:0]};
assign add3 = {3'b000,srcCy};
assign add3 = {3'b000,srcCy};
Line 354... Line 357...
      enable_div = 1'b0;
      enable_div = 1'b0;
    end
    end
  endcase
  endcase
end
end
 
 
always @(posedge clk or posedge rst)
always @(posedge clk or negedge resetn)
  if (rst) begin
  if (resetn == 1'b0) begin
    ides1_r <= #1 8'h0;
    ides1_r <= #1 8'h0;
  end else begin
  end else begin
    ides1_r <= #1 ides1;
    ides1_r <= #1 ides1;
  end
  end
 
 
always @(posedge clk or posedge rst)
always @(posedge clk or negedge resetn)
  if (rst) begin
  if (resetn == 1'b0) begin
    desCy <= #1 1'b0;
    desCy <= #1 1'b0;
    desAc <= #1 1'b0;
    desAc <= #1 1'b0;
    desOv <= #1 1'b0;
    desOv <= #1 1'b0;
    des1 <= #1 8'h00;
    des1 <= #1 8'h00;
    des2 <= #1 1'h00;
    des2 <= #1 1'h00;

powered by: WebSVN 2.1.0

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