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

Subversion Repositories or1k

[/] [or1k/] [branches/] [mp3_stable/] [or1200/] [rtl/] [verilog/] [or1200.v] - Rev 166

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

//////////////////////////////////////////////////////////////////////
////                                                              ////
////  OR1200 Top Level                                            ////
////                                                              ////
////  This file is part of the OpenRISC 1200 project              ////
////  http://www.opencores.org/cores/or1k/                        ////
////                                                              ////
////  Description                                                 ////
////  OR1200 Top Level                                            ////
////                                                              ////
////  To Do:                                                      ////
////   - make it smaller and faster                               ////
////                                                              ////
////  Author(s):                                                  ////
////      - Damjan Lampret, lampret@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: not supported by cvs2svn $
// Revision 1.1  2001/07/20 00:46:21  lampret
// Development version of RTL. Libraries are missing.
//
//
 
`include "general.h"
 
module or1200(
	clk, rst, pic_ints, clkdiv_by_2,
 
	// Instruction WISHBONE INTERFACE
	iwb_clk_i, iwb_rst_i, iwb_ack_i, iwb_err_i, iwb_rty_i, iwb_dat_i,
	iwb_cyc_o, iwb_adr_o, iwb_stb_o, iwb_we_o, iwb_sel_o, iwb_dat_o,
 
	// Data WISHBONE INTERFACE
	dwb_clk_i, dwb_rst_i, dwb_ack_i, dwb_err_i, dwb_rty_i, dwb_dat_i,
	dwb_cyc_o, dwb_adr_o, dwb_stb_o, dwb_we_o, dwb_sel_o, dwb_dat_o,
 
	// Trace
	tp_dir_in, tp_sel, tp_in, tp_out,
 
	// Power Management
	pm_clksd, pm_cpustall, pm_dc_gate, pm_ic_gate, pm_dmmu_gate, 
	pm_immu_gate, pm_tt_gate, pm_cpu_gate, pm_wakeup, pm_lvolt
 
);
 
parameter dw = `OPERAND_WIDTH;
parameter aw = `OPERAND_WIDTH;
parameter ppic_ints = `PIC_INTS;
 
//
// Instruction WISHBONE interface
//
input			iwb_clk_i;	// clock input
input			iwb_rst_i;	// reset input
input			iwb_ack_i;	// normal termination
input			iwb_err_i;	// termination w/ error
input			iwb_rty_i;	// termination w/ retry
input [dw-1:0]		iwb_dat_i;	// input data bus
output			iwb_cyc_o;	// cycle valid output
output [aw-1:0]		iwb_adr_o;	// address bus outputs
output			iwb_stb_o;	// strobe output
output			iwb_we_o;	// indicates write transfer
output [3:0]		iwb_sel_o;	// byte select outputs
output [dw-1:0]		iwb_dat_o;	// output data bus
 
//
// Data WISHBONE interface
//
input			dwb_clk_i;	// clock input
input			dwb_rst_i;	// reset input
input			dwb_ack_i;	// normal termination
input			dwb_err_i;	// termination w/ error
input			dwb_rty_i;	// termination w/ retry
input [dw-1:0]		dwb_dat_i;	// input data bus
output			dwb_cyc_o;	// cycle valid output
output [aw-1:0]		dwb_adr_o;	// address bus outputs
output			dwb_stb_o;	// strobe output
output			dwb_we_o;	// indicates write transfer
output [3:0]		dwb_sel_o;	// byte select outputs
output [dw-1:0]		dwb_dat_o;	// output data bus
 
//
// System
//
input 			clk;
input 			rst;
input 			clkdiv_by_2;
input [ppic_ints-1:0] 	pic_ints;
 
// CPU and PM
input			pm_cpustall;
output                  pm_clksd;
output                  pm_dc_gate;
output                  pm_ic_gate;
output                  pm_dmmu_gate;
output                  pm_immu_gate;
output                  pm_tt_gate;
output                  pm_cpu_gate;
output                  pm_wakeup;
output                  pm_lvolt;
 
// DC to BIU
wire 			dcbiu_rdy;
wire [dw-1:0] 		dcbiu_from_biu;
wire [dw-1:0] 		dcbiu_to_biu;
wire [aw-1:0] 		dcbiu_addr;
wire 			dcbiu_read;
wire 			dcbiu_write;
wire [3:0]		dcbiu_sel;
 
// IC to BIU
wire 			icbiu_rdy;
wire [dw-1:0] 		icbiu_from_biu;
wire [aw-1:0] 		icbiu_addr;
wire 			icbiu_read;
 
// CPU's SPR access to various RISC units (shared wires)
wire [aw-1:0]		spr_addr;
wire [dw-1:0]		spr_dat_cpu;
wire [31:0]		spr_cs;
wire			spr_we;
 
// DC and CPU's LSU
wire 			dclsu_stall;
wire [aw-1:0] 		dclsu_addr;
wire [aw-1:0] 		dclsu_from_dc;
wire [aw-1:0] 		dclsu_to_dc;
wire [`LSUOP_WIDTH-1:0] dclsu_lsuop;
 
// IC and CPU's ifetch
wire 			icfetch_stall;
wire [aw-1:0] 		icfetch_addr;
wire [dw-1:0] 		icfetch_dataout;
 
// Connection between CPU and PIC
wire [dw-1:0]		spr_dat_pic;
wire 			pic_wakeup;
wire 			int_low;
wire 			int_high;
wire			int_high_tt;
 
// Connection between CPU and PM
wire [dw-1:0]		spr_dat_pm;
 
// CPU and TT
wire [dw-1:0]		spr_dat_tt;
wire			tt_int;
 
// CPU and external Trace port
input 			tp_dir_in;
input [1:0] 		tp_sel;
input [dw-1:0] 		tp_in;
output [dw-1:0]		tp_out;
 
// Trace port and caches/MMUs
wire [`TP2W_WIDTH-1:0] 	tp2w;
wire [`TP3W_WIDTH-1:0] 	tp3w;
wire [`TP4W_WIDTH-1:0] 	tp4w;
wire [dw-1:0] 		tpdw;
 
//
// Assignments
//
assign int_high_tt = int_high | tt_int;
 
//
// Instantiation of Instruction WISHBONE BIU
//
wb_biu iwb_biu(
	// WISHBONE interface
	.wb_clk_i(iwb_clk_i),
	.wb_rst_i(iwb_rst_i),
	.wb_ack_i(iwb_ack_i),
	.wb_err_i(iwb_err_i),
	.wb_rty_i(iwb_rty_i),
	.wb_dat_i(iwb_dat_i),
	.wb_cyc_o(iwb_cyc_o),
	.wb_adr_o(iwb_adr_o),
	.wb_stb_o(iwb_stb_o),
	.wb_we_o(iwb_we_o),
	.wb_sel_o(iwb_sel_o),
	.wb_dat_o(iwb_dat_o),
 
	// Internal RISC bus
	.biu_to_biu(32'b0),
	.biu_addr(icbiu_addr),
	.biu_read(icbiu_read),
	.biu_write(1'b0),
	.biu_rdy(icbiu_rdy),
	.biu_from_biu(icbiu_from_biu),
	.biu_sel(4'b1111)
);
 
//
// Instantiation of Data WISHBONE BIU
//
wb_biu dwb_biu(
	// WISHBONE interface
	.wb_clk_i(dwb_clk_i),
	.wb_rst_i(dwb_rst_i),
	.wb_ack_i(dwb_ack_i),
	.wb_err_i(dwb_err_i),
	.wb_rty_i(dwb_rty_i),
	.wb_dat_i(dwb_dat_i),
	.wb_cyc_o(dwb_cyc_o),
	.wb_adr_o(dwb_adr_o),
	.wb_stb_o(dwb_stb_o),
	.wb_we_o(dwb_we_o),
	.wb_sel_o(dwb_sel_o),
	.wb_dat_o(dwb_dat_o),
 
	// Internal RISC bus
	.biu_to_biu(dcbiu_to_biu),
	.biu_addr(dcbiu_addr),
	.biu_read(dcbiu_read),
	.biu_write(dcbiu_write),
	.biu_rdy(dcbiu_rdy),
	.biu_from_biu(dcbiu_from_biu),
	.biu_sel(dcbiu_sel)
);
 
//
// Instantiation of Instruction Cache
//
ic ic(
	.clk(clk),
	.rst(rst),
	.clkdiv_by_2(clkdiv_by_2),
 
	// These connect IC to CPU's ifetch
	.icfetch_addr(icfetch_addr),
	.icfetch_op(`FETCHOP_LW),
	.icfetch_dataout(icfetch_dataout),
	.icfetch_stall(icfetch_stall),
 
	// These connect IC to BIU
	.icbiu_rdy(icbiu_rdy),
	.icbiu_datain(icbiu_from_biu),
	.icbiu_addr(icbiu_addr),
	.icbiu_read(icbiu_read),
 
	// These connect IC to SPRS
	.spr_dat_i(spr_dat_cpu),
 
	// Trace port
	.tp4w(tp4w),
	.tpdw(tpdw)
);
 
//
// Instantiation of Instruction Cache
//
cpu cpu(
	.clk(clk),
	.rst(rst),
 
	// These connect IC and IFETCHER inside CPU
	.ic_insn(icfetch_dataout),
	.ic_pcaddr(icfetch_addr),
	.ic_stall(icfetch_stall),
 
	// These connect CPU to external Trace port
	.tp_dir_in(tp_dir_in),
	.tp_sel(tp_sel),
	.tp_in(tp_in),
	.tp_out(tp_out),
 
	// These connect DC and CPU's LSU
	.dclsu_stall(dclsu_stall),
	.dclsu_addr(dclsu_addr),
	.dclsu_datain(dclsu_from_dc),
	.dclsu_dataout(dclsu_to_dc),
	.dclsu_lsuop(dclsu_lsuop),
 
	// These connect PIC and CPU's EXCEPT
	.int_high(int_high_tt),
	.int_low(int_low),
 
	// SPRs
	.spr_addr(spr_addr),
	.spr_dataout(spr_dat_cpu),
	.spr_dat_pic(spr_dat_pic),
	.spr_dat_tt(spr_dat_tt),
	.spr_dat_pm(spr_dat_pm),
	.spr_cs(spr_cs),
	.spr_we(spr_we),
 
	// These connect trace port to caches and MMUs
	.tp2w(tp2w),
	.tp3w(tp3w),
	.tp4w(tp4w),
	.tpdw(tpdw)
);
 
//
// Instantiation of Data Cache
//
dc dc(
	.clk(clk),
	.rst(rst),
	.clkdiv_by_2(clkdiv_by_2),
 
	// These connect DC to CPU's LSU
	.dclsu_addr(dclsu_addr),
	.dclsu_lsuop(dclsu_lsuop),
	.dclsu_datain(dclsu_to_dc),
	.dclsu_dataout(dclsu_from_dc),
	.dclsu_stall(dclsu_stall),
 
	// These connect DC to BIU
	.dcbiu_rdy(dcbiu_rdy),
	.dcbiu_datain(dcbiu_from_biu),
	.dcbiu_dataout(dcbiu_to_biu),
	.dcbiu_addr(dcbiu_addr),
	.dcbiu_read(dcbiu_read),
	.dcbiu_write(dcbiu_write),
	.dcbiu_sel(dcbiu_sel),
 
	// Trace port
	.tp2w(tp2w),
	.tp3w(tp3w),
	.tpdw(tpdw)
);
 
//
// Programmable interrupt controller
//
pic pic(
	// RISC Internal Interface
	.clk(clk),
	.rst(rst),
	.spr_cs(spr_cs[`SPR_GROUP_PIC]),
	.spr_write(spr_we),
	.spr_addr(spr_addr),
	.spr_dat_i(spr_dat_cpu),
	.spr_dat_o(spr_dat_pic),
	.pic_wakeup(pic_wakeup),
	.int_low(int_low), 
	.int_high(int_high),
 
	// PIC Interface
	.pic_int(pic_ints)
);
 
//
// Instantiation of Tick timer
//
tt tt(
	// RISC Internal Interface
	.clk(clk),
	.rst(rst),
	.spr_cs(spr_cs[`SPR_GROUP_TT]),
	.spr_write(spr_we),
	.spr_addr(spr_addr),
	.spr_dat_i(spr_dat_cpu),
	.spr_dat_o(spr_dat_tt),
	.int(tt_int)
);
 
//
// Instantiation of Power Management
//
pm pm(
	// RISC Internal Interface
	.clk(clk),
	.rst(rst),
	.pic_wakeup(pic_wakeup),
	.spr_write(spr_we),
	.spr_addr(spr_addr),
	.spr_dat_i(spr_dat_cpu),
	.spr_dat_o(spr_dat_pm),
 
	// Power Management Interface
	.pm_clksd(pm_clksd),
	.pm_cpustall(pm_cpustall),
	.pm_dc_gate(pm_dc_gate),
	.pm_ic_gate(pm_ic_gate),
	.pm_dmmu_gate(pm_dmmu_gate),
	.pm_immu_gate(pm_immu_gate),
	.pm_tt_gate(pm_tt_gate),
	.pm_cpu_gate(pm_cpu_gate),
	.pm_wakeup(pm_wakeup),
	.pm_lvolt(pm_lvolt)
);
 
 
endmodule
 
 
 
 
 
 
 
 

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

powered by: WebSVN 2.1.0

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