| 1 |
/* Using an oscilloscope you can see on pins tlvds_p and tlvds_n the signal with changing polarity. |
| 2 |
* You can also use a 100 Ohm resistor and two LEDs connected in opposite directions between these pins. |
| 3 |
*/ |
| 4 |
module top ( |
| 5 |
input clk, |
| 6 |
output elvds_p, |
| 7 |
output elvds_n, |
| 8 |
input key_i |
| 9 |
); |
| 10 |
|
| 11 |
wire key = key_i ^ `INV_BTN; |
| 12 |
|
| 13 |
reg [24:0] ctr_q; |
| 14 |
wire [24:0] ctr_d; |
| 15 |
wire i_tick; |
| 16 |
|
| 17 |
// Sequential code (flip-flop) |
| 18 |
always @(posedge clk) |
| 19 |
ctr_q <= ctr_d; |
| 20 |
|
| 21 |
// Combinational code (boolean logic) |
| 22 |
assign ctr_d = ctr_q + 1'b1; |
| 23 |
assign i_tick = |ctr_q[24:23]; |
| 24 |
|
| 25 |
ELVDS_TBUF diff_buf( |
| 26 |
.OEN(~key), |
| 27 |
.O(elvds_p), |
| 28 |
.OB(elvds_n), |
| 29 |
.I(i_tick) |
| 30 |
); |
| 31 |
|
| 32 |
endmodule |
| 33 |
|