Line 36... |
Line 36... |
//// POSSIBILITY OF SUCH DAMAGE. ////
|
//// POSSIBILITY OF SUCH DAMAGE. ////
|
//// ////
|
//// ////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
// CVS Log
|
// CVS Log
|
//
|
//
|
// $Id: z80_testbed.v,v 1.2 2004-05-18 22:31:21 bporcella Exp $
|
// $Id: z80_testbed.v,v 1.3 2004-05-21 02:51:25 bporcella Exp $
|
//
|
//
|
// $Date: 2004-05-18 22:31:21 $
|
// $Date: 2004-05-21 02:51:25 $
|
// $Revision: 1.2 $
|
// $Revision: 1.3 $
|
// $Author: bporcella $
|
// $Author: bporcella $
|
// $Locker: $
|
// $Locker: $
|
// $State: Exp $
|
// $State: Exp $
|
//
|
//
|
// Change History:
|
// Change History:
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.2 2004/05/18 22:31:21 bporcella
|
|
// instruction test getting to final stages
|
|
//
|
// Revision 1.1 2004/05/13 14:57:35 bporcella
|
// Revision 1.1 2004/05/13 14:57:35 bporcella
|
// testbed files
|
// testbed files
|
//
|
//
|
// Revision 1.1.1.1 2004/04/13 23:47:42 bporcella
|
// Revision 1.1.1.1 2004/04/13 23:47:42 bporcella
|
// import first files
|
// import first files
|
Line 81... |
Line 84... |
.wb_we_o(wb_we),
|
.wb_we_o(wb_we),
|
.wb_adr_o(wb_adr),
|
.wb_adr_o(wb_adr),
|
.wb_tga_o(wb_tga),
|
.wb_tga_o(wb_tga),
|
.wb_ack_i(ack),
|
.wb_ack_i(ack),
|
.wb_clk_i(clk),
|
.wb_clk_i(clk),
|
.wb_dat_i(8'b0),
|
.wb_dat_i(io_i),
|
.wb_rst_i(rst),
|
.wb_rst_i(rst),
|
.bist_ack_o(bist_ack),
|
.bist_ack_o(bist_ack),
|
.bist_err_o(bist_err),
|
.bist_err_o(bist_err),
|
.bist_req_i(bist_req),
|
.bist_req_i(bist_req),
|
.int_req_i(1'b0) // initial test inst test only
|
.int_req_i(1'b0) // initial test inst test only
|
Line 95... |
Line 98... |
reg ack;
|
reg ack;
|
wire [1:0] wb_tga;
|
wire [1:0] wb_tga;
|
wire [15:0] wb_adr;
|
wire [15:0] wb_adr;
|
wire wb_stb, wb_cyc, wb_we;
|
wire wb_stb, wb_cyc, wb_we;
|
wire [7:0] wb_dat;
|
wire [7:0] wb_dat;
|
|
wire [7:0] io_i;
|
|
reg [7:0] out_state;
|
|
|
parameter TAG_IO = 2'b01, // need to review general wb usage to undrstand how best to
|
parameter TAG_IO = 2'b01, // need to review general wb usage to undrstand how best to
|
TAG_INT = 2'b10; // document this.
|
TAG_INT = 2'b10; // document this.
|
|
|
// a pretty simple output device
|
parameter MY_IO_ADR = 8'h10 ;
|
|
// ----------------- a pretty simple I/O device -------
|
|
// output simply displays the data written --
|
|
// input cycles through
|
|
// various interesting data patterens as used by the instruction test
|
|
// namely 7f 55 80 0 ff aa
|
|
|
|
|
|
assign io_i = (wb_adr[7:0] == MY_IO_ADR) & wb_stb & wb_cyc & (wb_tga == TAG_IO) & !wb_we ?
|
|
out_state : 8'hz;
|
|
wire a2me = (wb_adr[7:0] == MY_IO_ADR) & wb_stb & wb_cyc & (wb_tga == TAG_IO);
|
|
|
wire wr2me = (wb_adr[7:0] == 8'h10) & wb_stb & wb_cyc & (wb_tga == TAG_IO) & wb_we;
|
|
always @(posedge clk or posedge rst)
|
always @(posedge clk or posedge rst)
|
begin
|
begin
|
if (rst ) ack <= 1'b0;
|
if (rst ) ack <= 1'b0;
|
else if (wr2me & !ack)
|
else if (a2me & !ack)
|
begin
|
begin
|
ack <= 1'b1;
|
ack <= 1'b1;
|
$write("%s",wb_dat);
|
if (wb_we) $write("%s",wb_dat);
|
end
|
end
|
else ack <= 1'b0;
|
else ack <= 1'b0;
|
|
end
|
|
|
|
always @(posedge clk or posedge rst)
|
|
begin
|
|
if (rst) out_state <= 8'h7f;
|
|
else if (a2me & !wb_we & ack)
|
|
case (out_state)
|
|
8'h7f: out_state <= 8'h55 ;
|
|
8'h55: out_state <= 8'h80 ;
|
|
8'h80: out_state <= 8'h00 ;
|
|
8'h00: out_state <= 8'hff ;
|
|
8'hff: out_state <= 8'haa ;
|
|
8'haa: out_state <= 8'h7f ;
|
|
default: out_state <= 8'h7f ;
|
|
endcase
|
end
|
end
|
|
|
|
|
|
|
initial
|
initial
|
begin
|
begin
|
clk = 0;
|
clk = 0;
|
// timeout if u hang up -- always a good idea.
|
// timeout if u hang up -- always a good idea.
|
#500000 $finish;
|
#500000 $finish;
|