| 1 |
131 |
jt_eaton |
//////////////////////////////////////////////////////////////////////
|
| 2 |
|
|
//// ////
|
| 3 |
|
|
//// wb_master_model ////
|
| 4 |
|
|
//// ////
|
| 5 |
|
|
//// This file is part of the SPI IP core project ////
|
| 6 |
|
|
//// http://www.opencores.org/projects/spi/ ////
|
| 7 |
|
|
//// ////
|
| 8 |
|
|
//// Author(s): ////
|
| 9 |
|
|
//// - Simon Srot (simons@opencores.org) ////
|
| 10 |
|
|
//// ////
|
| 11 |
|
|
//// Based on: ////
|
| 12 |
|
|
//// - i2c/bench/verilog/wb_master_model.v ////
|
| 13 |
|
|
//// Copyright (C) 2001 Richard Herveille ////
|
| 14 |
|
|
//// ////
|
| 15 |
|
|
//// All additional information is avaliable in the Readme.txt ////
|
| 16 |
|
|
//// file. ////
|
| 17 |
|
|
//// ////
|
| 18 |
|
|
//////////////////////////////////////////////////////////////////////
|
| 19 |
|
|
//// ////
|
| 20 |
|
|
//// Copyright (C) 2002 Authors ////
|
| 21 |
|
|
//// ////
|
| 22 |
|
|
//// This source file may be used and distributed without ////
|
| 23 |
|
|
//// restriction provided that this copyright statement is not ////
|
| 24 |
|
|
//// removed from the file and that any derivative work contains ////
|
| 25 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
| 26 |
|
|
//// ////
|
| 27 |
|
|
//// This source file is free software; you can redistribute it ////
|
| 28 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
| 29 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
| 30 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
| 31 |
|
|
//// later version. ////
|
| 32 |
|
|
//// ////
|
| 33 |
|
|
//// This source is distributed in the hope that it will be ////
|
| 34 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
| 35 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
| 36 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
| 37 |
|
|
//// details. ////
|
| 38 |
|
|
//// ////
|
| 39 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
| 40 |
|
|
//// Public License along with this source; if not, download it ////
|
| 41 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
| 42 |
|
|
//// ////
|
| 43 |
|
|
//////////////////////////////////////////////////////////////////////
|
| 44 |
|
|
module model_master
|
| 45 |
|
|
#( parameter dwidth = 32,
|
| 46 |
|
|
parameter awidth = 32
|
| 47 |
|
|
)(
|
| 48 |
|
|
input wire clk,
|
| 49 |
|
|
input wire reset,
|
| 50 |
|
|
output reg [awidth -1:0] adr,
|
| 51 |
|
|
output reg [dwidth -1:0] dout,
|
| 52 |
|
|
output reg cyc,
|
| 53 |
|
|
output reg stb,
|
| 54 |
|
|
output reg we,
|
| 55 |
|
|
output reg [dwidth/8 -1:0] sel,
|
| 56 |
|
|
input wire [dwidth -1:0] din,
|
| 57 |
|
|
input wire ack,
|
| 58 |
|
|
input wire err,
|
| 59 |
|
|
input wire rty
|
| 60 |
|
|
);
|
| 61 |
|
|
|
| 62 |
|
|
// Internal signals
|
| 63 |
|
|
reg [dwidth -1:0] q;
|
| 64 |
|
|
always@(posedge clk)
|
| 65 |
|
|
if(reset)
|
| 66 |
|
|
begin
|
| 67 |
|
|
adr <= {awidth{1'b0}};
|
| 68 |
|
|
dout <= {dwidth{1'b0}};
|
| 69 |
|
|
cyc <= 1'b0;
|
| 70 |
|
|
stb <= 1'b0;
|
| 71 |
|
|
we <= 1'h0;
|
| 72 |
|
|
sel <= {dwidth/8{1'b0}};
|
| 73 |
|
|
end
|
| 74 |
|
|
|
| 75 |
|
|
|
| 76 |
|
|
|
| 77 |
|
|
endmodule
|