1 /////////////////////////////////////////////////////////////////////
3 //// WISHBONE Master Model ////
6 //// Author: Rudolf Usselmann ////
7 //// rudi@asics.ws ////
10 /////////////////////////////////////////////////////////////////////
12 //// Copyright (C) 2000-2002 Rudolf Usselmann ////
13 //// www.asics.ws ////
14 //// rudi@asics.ws ////
16 //// This source file may be used and distributed without ////
17 //// restriction provided that this copyright statement is not ////
18 //// removed from the file and that any derivative work contains ////
19 //// the original copyright notice and the associated disclaimer.////
21 //// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
22 //// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
23 //// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
24 //// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
25 //// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
26 //// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
27 //// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
28 //// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
29 //// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
30 //// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
31 //// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
32 //// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
33 //// POSSIBILITY OF SUCH DAMAGE. ////
35 /////////////////////////////////////////////////////////////////////
39 // $Id: wb_mast_model.v,v 1.1.1.1 2003/04/19 08:40:15 johny Exp $
41 // $Date: 2003/04/19 08:40:15 $
42 // $Revision: 1.1.1.1 $
48 // $Log: wb_mast_model.v,v $
49 // Revision 1.1.1.1 2003/04/19 08:40:15 johny
52 // Revision 1.2 2002/10/03 05:40:03 rudi
53 // Fixed a minor bug in parameter passing, updated headers and specification.
55 // Revision 1.1.1.1 2001/10/19 11:04:23 rudi
56 // WISHBONE CONMAX IP Core
63 `include "wb_model_defines.v"
65 module wb_mast(clk, rst, adr, din, dout, cyc, stb, sel, we, ack, err, rty);
76 ////////////////////////////////////////////////////////////////////
81 parameter mem_size = 4096;
89 reg [31:0] mem[mem_size:0];
92 ////////////////////////////////////////////////////////////////////
99 //adr = 32'hxxxx_xxxx;
102 dout = 32'hxxxx_xxxx;
109 $display("\nINFO: WISHBONE MASTER MODEL INSTANTIATED (%m)\n");
120 for(n=0;n<mem_size;n=n+1)
127 ////////////////////////////////////////////////////////////////////
149 while(~ack & ~err) @(posedge clk);
154 //adr = 32'hffff_ffff;
156 dout = 32'hxxxx_xxxx;
164 ////////////////////////////////////////////////////////////////////
166 // Write 4 Words Task
197 while(~ack & ~err) @(posedge clk);
201 dout = 32'hxxxx_xxxx;
215 while(~ack & ~err) @(posedge clk);
219 dout = 32'hxxxx_xxxx;
231 while(~ack & ~err) @(posedge clk);
235 dout = 32'hxxxx_xxxx;
248 while(~ack & ~err) @(posedge clk);
256 //adr = 32'hffff_ffff;
257 dout = 32'hxxxx_xxxx;
281 for(n=0;n<count;n=n+1)
293 if(n!=0) @(posedge clk);
294 while(~ack & ~err) @(posedge clk);
299 dout = 32'hxxxx_xxxx;
300 //adr = 32'hxxxx_xxxx;
307 //adr = 32'hffff_ffff;
333 repeat(delay) @(posedge clk);
335 for(n=0;n<rcount-1;n=n+1)
339 while(~ack & ~err) @(posedge clk);
341 //$display("Rd Mem[%0d]: %h", (n + cnt), mem[n + cnt] );
359 while(~ack & ~err) @(posedge clk);
361 //$display("Rd Mem[%0d]: %h", (n + cnt), mem[n + cnt] );
373 for(n=0;n<wcount;n=n+1)
387 while(~ack & ~err) @(posedge clk);
392 dout = 32'hxxxx_xxxx;
399 //adr = 32'hffff_ffff;
429 for(n=0;n<wcount;n=n+1)
442 while(~ack & ~err) @(posedge clk);
447 dout = 32'hxxxx_xxxx;
453 repeat(delay) @(posedge clk);
458 for(n=0;n<rcount-1;n=n+1)
462 while(~ack & ~err) @(posedge clk);
464 //$display("Rd Mem[%0d]: %h", (n + cnt), mem[n + cnt] );
482 while(~ack & ~err) @(posedge clk);
485 //$display("Rd Mem[%0d]: %h", (n + cnt), mem[n + cnt] );
500 ////////////////////////////////////////////////////////////////////
521 while(~ack & ~err) @(posedge clk);
526 //adr = 32'hxxxx_xxxx;
529 dout = 32'hxxxx_xxxx;
538 ////////////////////////////////////////////////////////////////////
562 repeat(delay) @(posedge clk);
566 while(~ack & ~err) @(posedge clk);
584 while(~ack & ~err) @(posedge clk);
603 while(~ack & ~err) @(posedge clk);
621 while(~ack & ~err) @(posedge clk);
652 repeat(delay) @(posedge clk);
654 for(n=0;n<count-1;n=n+1)
658 while(~ack & ~err) @(posedge clk);
664 //adr = 32'hxxxx_xxxx;
678 while(~ack & ~err) @(posedge clk);
685 //adr = 32'hffff_ffff;
686 //adr = 32'hxxxx_xxxx;