OpenCores
URL https://opencores.org/ocsvn/uart_observer/uart_observer/trunk

Subversion Repositories uart_observer

[/] [uart_observer/] [trunk/] [verilog/] [uart_observer_demonstrator.v] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 audriusa
/**
2
* Demonstrates the functionality of the UART observer.  Shows the 64 bits of
3
* binary data that, in this demo, are derived from push buttons and dip switches on FPGA board.
4
*/
5
module uart_observer_demonstrator (
6
  input USB_UART_TX_FPGA_RX_LS,
7
  input USB_UART_CTS_I_B_LS,
8
  input CLK_I,
9
 
10
  input GPIO_SW_E,
11
  input GPIO_SW_W,
12
  input GPIO_SW_S,
13
  input GPIO_SW_N,
14
  input GPIO_SW_C,
15
 
16
  input GPIO_DIP_SW0,
17
  input GPIO_DIP_SW1,
18
  input GPIO_DIP_SW2,
19
  input GPIO_DIP_SW3,
20
 
21
  output GPIO_LED_0,
22
  output GPIO_LED_1,
23
  output GPIO_LED_2,
24
  output GPIO_LED_3,
25
  output GPIO_LED_4,
26
  output GPIO_LED_5,
27
  output GPIO_LED_6,
28
  output GPIO_LED_7,
29
 
30
  output USB_UART_RX_FPGA_TX_LS,
31
  output USB_UART_RTS_O_B_LS
32
);
33
 
34
 // 64 bits we observe.
35
 wire [63:0] observables;
36
 
37
 // Observe the switches as example
38
 // First byte
39
 
40
 assign observables[0] = GPIO_SW_E;
41
 assign observables[1] = GPIO_SW_W;
42
 assign observables[2] = GPIO_SW_S;
43
 assign observables[3] = GPIO_SW_N;
44
 
45
 assign observables[4] = GPIO_SW_E;
46
 assign observables[5] = GPIO_SW_W;
47
 assign observables[6] = GPIO_SW_S;
48
 assign observables[7] = GPIO_SW_N;
49
 
50
 // Second
51
 
52
 assign observables[8] = GPIO_SW_E;
53
 assign observables[9] = GPIO_SW_W;
54
 assign observables[10] = GPIO_SW_S;
55
 assign observables[11] = GPIO_SW_N;
56
 
57
 assign observables[12] = GPIO_SW_E;
58
 assign observables[13] = GPIO_SW_W;
59
 assign observables[14] = GPIO_SW_S;
60
 assign observables[15] = GPIO_SW_N;
61
 
62
 // Third
63
 
64
 assign observables[16] = GPIO_DIP_SW0;
65
 assign observables[17] = GPIO_DIP_SW1;
66
 assign observables[18] = GPIO_DIP_SW2;
67
 assign observables[19] = GPIO_DIP_SW3;
68
 
69
 assign observables[20] = GPIO_DIP_SW3;
70
 assign observables[21] = GPIO_DIP_SW2;
71
 assign observables[22] = GPIO_DIP_SW1;
72
 assign observables[23] = GPIO_DIP_SW0;
73
 
74
 // Forth
75
 
76
 assign observables[24] = GPIO_SW_E;
77
 assign observables[25] = GPIO_SW_W;
78
 assign observables[26] = GPIO_SW_S;
79
 assign observables[27] = GPIO_SW_N;
80
 
81
 assign observables[28] = GPIO_SW_E;
82
 assign observables[29] = GPIO_SW_W;
83
 assign observables[30] = GPIO_SW_S;
84
 assign observables[31] = GPIO_SW_N;
85
 
86
 assign observables[63] = GPIO_SW_C;
87
 
88
 uart_observer #(.CLOCK_FREQ (90_000_000), .BAUDS(921600), .BITS(64) )
89
 U0(
90
  // Clock
91
  .CLK_I(CLK_I),
92
 
93
  // Values to observer
94
  .DAT_I(observables),
95
 
96
  // UART
97
  .TXD(USB_UART_RX_FPGA_TX_LS), // data  
98
  .RTS(USB_UART_RTS_O_B_LS),    // request to send
99
  .CTS(USB_UART_CTS_I_B_LS)    // clear to send
100
 
101
 );
102
 
103
 assign GPIO_LED_0 = observables[0];
104
 assign GPIO_LED_1 = observables[1];
105
 assign GPIO_LED_2 = observables[2];
106
 assign GPIO_LED_3 = observables[3];
107
 assign GPIO_LED_4 = observables[4];
108
 
109
 
110
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.