File: power_trig_tb.v

package info (click to toggle)
uhd 3.7.3-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 456,376 kB
  • ctags: 89,637
  • sloc: ansic: 51,090; cpp: 42,755; xml: 19,627; vhdl: 12,678; tcl: 5,944; python: 5,870; ada: 2,760; sh: 2,175; makefile: 615; pascal: 230; csh: 224; perl: 11
file content (71 lines) | stat: -rw-r--r-- 1,767 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
// Copyright 2012 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//


module power_trig_tb();
   initial $dumpfile("power_trig_tb.vcd");
   initial $dumpvars(0,power_trig_tb);

   reg clk = 0;
   always #10 clk <= ~clk;
   reg rst = 1;
   initial #100 rst <= 0;

   initial
     begin
	set_stb <= 0;
	#1000;
	set_stb <= 1;
     end
   
   reg [31:0] sample_in;
   reg 	      strobe_in;
   wire [31:0] sample_out;
   wire        strobe_out;
   reg 	       set_stb, run;
   
   power_trig #(.BASE(0)) power_trig
     (.clk(clk), .reset(rst), .enable(1),
      .set_stb(set_stb), .set_addr(0), .set_data(32'h000B_B000),
      .run(run),

      .ddc_out_sample(sample_in), .ddc_out_strobe(strobe_in),
      .bb_sample(sample_out), .bb_strobe(strobe_out));

   initial sample_in <= 32'h0100_0300;
   
   always @(posedge clk)
     if(~strobe_in)
       sample_in <= sample_in + 32'h0001_0001;

   initial
     #100000 $finish;

   initial 
     begin
	run <= 0;
	#2000 run <= 1;
	#30000 run <= 0;
     end

   always @(posedge clk)
     if(rst | ~run)
       strobe_in <= 0;
     else
       strobe_in <= ~strobe_in;
   
endmodule // power_trig_tb