recover_pk Flake8 ignore E501
[RRG-proxmark3.git] / fpga / tests / testbed_hi_simulate.v
blob02ea3370c340dc4b3361e9480530f21077cce7e0
1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
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.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
17 `include "hi_simulate.v"
20 pck0 - input main 24MHz clock (PLL / 4)
21 [7:0] adc_d - input data from A/D converter
22 mod_type - modulation type
24 pwr_lo - output to coil drivers (ssp_clk / 8)
25 adc_clk - output A/D clock signal
26 ssp_frame - output SSS frame indicator (goes high while the 8 bits are shifted)
27 ssp_din - output SSP data to ARM (shifts 8 bit A/D value serially to ARM MSB first)
28 ssp_clk - output SSP clock signal
30 ck_1356meg - input unused
31 ck_1356megb - input unused
32 ssp_dout - input unused
33 cross_hi - input unused
34 cross_lo - input unused
36 pwr_hi - output unused, tied low
37 pwr_oe1 - output unused, undefined
38 pwr_oe2 - output unused, undefined
39 pwr_oe3 - output unused, undefined
40 pwr_oe4 - output unused, undefined
41 dbg - output alias for adc_clk
44 module testbed_hi_simulate;
45 reg pck0;
46 reg [7:0] adc_d;
47 reg mod_type;
49 wire pwr_lo;
50 wire adc_clk;
51 reg ck_1356meg;
52 reg ck_1356megb;
53 wire ssp_frame;
54 wire ssp_din;
55 wire ssp_clk;
56 reg ssp_dout;
57 wire pwr_hi;
58 wire pwr_oe1;
59 wire pwr_oe2;
60 wire pwr_oe3;
61 wire pwr_oe4;
62 wire cross_lo;
63 wire cross_hi;
64 wire dbg;
66 hi_simulate #(5,200) dut(
67 .pck0(pck0),
68 .ck_1356meg(ck_1356meg),
69 .ck_1356megb(ck_1356megb),
70 .pwr_lo(pwr_lo),
71 .pwr_hi(pwr_hi),
72 .pwr_oe1(pwr_oe1),
73 .pwr_oe2(pwr_oe2),
74 .pwr_oe3(pwr_oe3),
75 .pwr_oe4(pwr_oe4),
76 .adc_d(adc_d),
77 .adc_clk(adc_clk),
78 .ssp_frame(ssp_frame),
79 .ssp_din(ssp_din),
80 .ssp_dout(ssp_dout),
81 .ssp_clk(ssp_clk),
82 .cross_hi(cross_hi),
83 .cross_lo(cross_lo),
84 .dbg(dbg),
85 .mod_type(mod_type)
88 integer idx, i;
90 // main clock
91 always #5 begin
92 ck_1356megb = !ck_1356megb;
93 ck_1356meg = ck_1356megb;
94 end
96 always begin
97 @(negedge adc_clk) ;
98 adc_d = $random;
99 end
101 //crank DUT
102 task crank_dut;
103 begin
104 @(negedge ssp_clk) ;
105 ssp_dout = $random;
107 endtask
109 initial begin
111 // init inputs
112 ck_1356megb = 0;
113 // random values
114 adc_d = 0;
115 ssp_dout=1;
117 // shallow modulation off
118 mod_type=0;
119 for (i = 0 ; i < 16 ; i = i + 1) begin
120 crank_dut;
123 // shallow modulation on
124 mod_type=1;
125 for (i = 0 ; i < 16 ; i = i + 1) begin
126 crank_dut;
128 $finish;
131 endmodule // main