1//
2// Copyright 2011 Ettus Research LLC
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16//
17
18
19
20module setting_reg
21  #(parameter my_addr = 0,
22    parameter width = 32,
23    parameter at_reset=32'd0)
24    (input clk, input rst, input strobe, input wire [7:0] addr,
25     input wire [31:0] in, output reg [width-1:0] out, output reg changed);
26
27   always @(posedge clk)
28     if(rst)
29       begin
30	  out <= at_reset;
31	  changed <= 1'b0;
32       end
33     else
34       if(strobe & (my_addr==addr))
35	 begin
36	    out <= in;
37	    changed <= 1'b1;
38	 end
39       else
40	 changed <= 1'b0;
41
42endmodule // setting_reg
43