R&Y: Added DAY RTA Tapp Card and Additional BKK BEM Stored Value Card AIDs to `aid_de...
[RRG-proxmark3.git] / fpga / tests / testbed_lo_simulate.v
blob5b06d3d57b92b97a5d40d6dd399231aa9071ae21
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 "lo_simulate.v"
20 pck0 - input main 24MHz clock (PLL / 4)
21 [7:0] adc_d - input data from A/D converter
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_lo_simulate;
45 reg pck0;
46 reg [7:0] adc_d;
49 wire pwr_lo;
50 wire adc_clk;
51 wire ck_1356meg;
52 wire 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 reg cross_lo;
63 wire cross_hi;
64 wire dbg;
66 lo_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)
88 integer i, counter=0;
90 // main clock
91 always #5 pck0 = !pck0;
93 //cross_lo is not really synced to pck0 but it's roughly pck0/192 (24MHz/192=125kHz)
94 task crank_dut;
95 begin
96 @(posedge pck0) ;
97 counter = counter + 1;
98 if (counter == 192) begin
99 counter = 0;
100 ssp_dout = $random;
101 cross_lo = 1;
102 end else begin
103 cross_lo = 0;
107 endtask
109 initial begin
110 pck0 = 0;
111 for (i = 0 ; i < 4096 ; i = i + 1) begin
112 crank_dut;
114 $finish;
117 endmodule // main