📄 oc8051_top.v
字号:
////////////////////////////////////////////////////////////////////////// //////// 8051 cores top level module //////// //////// This file is part of the 8051 cores project //////// http://www.opencores.org/cores/8051/ //////// //////// Description //////// 8051 definitions. //////// //////// To Do: //////// nothing //////// //////// Author(s): //////// - Simon Teran, simont@opencores.org //////// ////////////////////////////////////////////////////////////////////////////// //////// Copyright (C) 2000 Authors and OPENCORES.ORG //////// //////// This source file may be used and distributed without //////// restriction provided that this copyright statement is not //////// removed from the file and that any derivative work contains //////// the original copyright notice and the associated disclaimer. //////// //////// This source file is free software; you can redistribute it //////// and/or modify it under the terms of the GNU Lesser General //////// Public License as published by the Free Software Foundation; //////// either version 2.1 of the License, or (at your option) any //////// later version. //////// //////// This source is distributed in the hope that it will be //////// useful, but WITHOUT ANY WARRANTY; without even the implied //////// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //////// PURPOSE. See the GNU Lesser General Public License for more //////// details. //////// //////// You should have received a copy of the GNU Lesser General //////// Public License along with this source; if not, download it //////// from http://www.opencores.org/lgpl.shtml //////// ////////////////////////////////////////////////////////////////////////////// CVS Revision History//// $Log: oc8051_top.v,v $// Revision 1.33 2003/07/01 21:49:00 simont// Simulation reports added.//// Revision 1.32 2003/06/20 13:36:37 simont// ram modules added.//// Revision 1.31 2003/06/17 14:17:22 simont// BIST signals added.//// Revision 1.30 2003/06/03 16:51:24 simont// include "8051_defines" added.//// Revision 1.29 2003/05/07 12:36:03 simont// chsnge comp.des to des1//// Revision 1.28 2003/05/06 09:41:35 simont// remove define OC8051_AS2_PCL, chane signal src_sel2 to 2 bit wide.//// Revision 1.27 2003/05/05 15:46:37 simont// add aditional alu destination to solve critical path.//// Revision 1.26 2003/04/29 11:24:31 simont// fix bug in case execution of two data dependent instructions.//// Revision 1.25 2003/04/25 17:15:51 simont// change branch instruction execution (reduse needed clock periods).//// Revision 1.24 2003/04/11 10:05:59 simont// deifne OC8051_ROM added//// Revision 1.23 2003/04/10 12:43:19 simont// defines for pherypherals added//// Revision 1.22 2003/04/09 16:24:04 simont// change wr_sft to 2 bit wire.//// Revision 1.21 2003/04/09 15:49:42 simont// Register oc8051_sfr dato output, add signal wait_data.//// Revision 1.20 2003/04/03 19:13:28 simont// Include instruction cache.//// Revision 1.19 2003/04/02 15:08:30 simont// raname signals.//// Revision 1.18 2003/01/13 14:14:41 simont// replace some modules//// Revision 1.17 2002/11/05 17:23:54 simont// add module oc8051_sfr, 256 bytes internal ram//// Revision 1.16 2002/10/28 14:55:00 simont// fix bug in interface to external data ram//// Revision 1.15 2002/10/23 16:53:39 simont// fix bugs in instruction interface//// Revision 1.14 2002/10/17 18:50:00 simont// cahnge interface to instruction rom//// Revision 1.13 2002/09/30 17:33:59 simont// prepared header////// synopsys translate_off`include "oc8051_timescale.v"// synopsys translate_on`include "oc8051_defines.v"module oc8051_top (wb_rst_i, wb_clk_i,//interface to instruction rom wbi_adr_o, wbi_dat_i, wbi_stb_o, wbi_ack_i, wbi_cyc_o, wbi_err_i,//interface to data ram wbd_dat_i, wbd_dat_o, wbd_adr_o, wbd_we_o, wbd_ack_i, wbd_stb_o, wbd_cyc_o, wbd_err_i,// interrupt interface int0_i, int1_i,// port interface `ifdef OC8051_PORTS `ifdef OC8051_PORT0 p0_i, p0_o, `endif `ifdef OC8051_PORT1 p1_i, p1_o, `endif `ifdef OC8051_PORT2 p2_i, p2_o, `endif `ifdef OC8051_PORT3 p3_i, p3_o, `endif `endif// serial interface `ifdef OC8051_UART rxd_i, txd_o, `endif// counter interface `ifdef OC8051_TC01 t0_i, t1_i, `endif `ifdef OC8051_TC2 t2_i, t2ex_i, `endif// BIST`ifdef OC8051_BIST scanb_rst, scanb_clk, scanb_si, scanb_so, scanb_en,`endif// external access (active low) ea_in );input wb_rst_i, // reset input wb_clk_i, // clock input int0_i, // interrupt 0 int1_i, // interrupt 1 ea_in, // external access wbd_ack_i, // data acknowalge wbi_ack_i, // instruction acknowlage wbd_err_i, // data error wbi_err_i; // instruction errorinput [7:0] wbd_dat_i; // ram data inputinput [31:0] wbi_dat_i; // rom data inputoutput wbd_we_o, // data write enable wbd_stb_o, // data strobe wbd_cyc_o, // data cycle wbi_stb_o, // instruction strobe wbi_cyc_o; // instruction cycleoutput [7:0] wbd_dat_o; // data outputoutput [15:0] wbd_adr_o, // data address wbi_adr_o; // instruction address`ifdef OC8051_PORTS`ifdef OC8051_PORT0input [7:0] p0_i; // port 0 inputoutput [7:0] p0_o; // port 0 output`endif`ifdef OC8051_PORT1input [7:0] p1_i; // port 1 inputoutput [7:0] p1_o; // port 1 output`endif`ifdef OC8051_PORT2input [7:0] p2_i; // port 2 inputoutput [7:0] p2_o; // port 2 output`endif`ifdef OC8051_PORT3input [7:0] p3_i; // port 3 inputoutput [7:0] p3_o; // port 3 output`endif`endif`ifdef OC8051_UARTinput rxd_i; // receiveoutput txd_o; // transnmit`endif`ifdef OC8051_TC01input t0_i, // counter 0 input t1_i; // counter 1 input`endif`ifdef OC8051_TC2input t2_i, // counter 2 input t2ex_i; //`endif`ifdef OC8051_BISTinput scanb_rst;input scanb_clk;input scanb_si;output scanb_so;input scanb_en;wire scanb_soi;`endifwire [7:0] dptr_hi, dptr_lo, ri, data_out, op1, op2, op3, acc, p0_out, p1_out, p2_out, p3_out, sp, sp_w;wire [31:0] idat_onchip;wire [15:0] pc;assign wbd_cyc_o = wbd_stb_o;wire src_sel3;wire [1:0] wr_sfr, src_sel2;wire [2:0] ram_rd_sel, // ram read ram_wr_sel, // ram write src_sel1;wire [7:0] ram_data, ram_out, //data from ram sfr_out, wr_dat, wr_addr, //ram write addres rd_addr; //data ram read addreswire sfr_bit;wire [1:0] cy_sel, //carry select; from decoder to cy_selct1 bank_sel;wire rom_addr_sel, //rom addres select; alu or pc rmw, ea_int;wire reti, intr, int_ack, istb;wire [7:0] int_src;wire mem_wait;wire [2:0] mem_act;wire [3:0] alu_op; //alu operation (from decoder)wire [1:0] psw_set; //write to psw or not; from decoder to psw (through register)wire [7:0] src1, //alu sources 1 src2, //alu sources 2 src3, //alu sources 3 des_acc, des1, //alu destination 1 des2; //alu destinations 2wire desCy, //carry out desAc, desOv, //overflow alu_cy, wr, //write to data ram wr_o;wire rd, //read program rom pc_wr;wire [2:0] pc_wr_sel; //program counter write select (from decoder to pc)wire [7:0] op1_n, //from memory_interface to decoder op2_n, op3_n;wire [1:0] comp_sel; //select source1 and source2 to comparewire eq, //result (from comp1 to decoder) srcAc, cy, rd_ind, wr_ind, comp_wait;wire [2:0] op1_cur;wire bit_addr, //bit addresable instruction bit_data, //bit data from ram to ram_select bit_out, //bit data from ram_select to alu and cy_select bit_addr_o, wait_data;//// cpu to cache/wb_interfacewire iack_i, istb_o, icyc_o;wire [31:0] idat_i;wire [15:0] iadr_o;//// decoderoc8051_decoder oc8051_decoder1(.clk(wb_clk_i), .rst(wb_rst_i), .op_in(op1_n), .op1_c(op1_cur), .ram_rd_sel_o(ram_rd_sel), .ram_wr_sel_o(ram_wr_sel), .bit_addr(bit_addr), .src_sel1(src_sel1), .src_sel2(src_sel2), .src_sel3(src_sel3), .alu_op_o(alu_op), .psw_set(psw_set), .cy_sel(cy_sel), .wr_o(wr), .pc_wr(pc_wr), .pc_sel(pc_wr_sel), .comp_sel(comp_sel), .eq(eq), .wr_sfr_o(wr_sfr), .rd(rd), .rmw(rmw), .istb(istb), .mem_act(mem_act), .mem_wait(mem_wait), .wait_data(wait_data));wire [7:0] sub_result;////aluoc8051_alu oc8051_alu1(.rst(wb_rst_i), .clk(wb_clk_i), .op_code(alu_op),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -