CDL Modules
leds.h
Go to the documentation of this file.
1 
22 /*a Constants */
23 constant bit[16] led_seven_seg_hex_a = 16b_1101011111101101 "Which hex values require lighting of LED segment A";
24 constant bit[16] led_seven_seg_hex_b = 16b_0010011110011111 "Which hex values require lighting of LED segment B";
25 constant bit[16] led_seven_seg_hex_c = 16b_0010111111111011 "Which hex values require lighting of LED segment C";
26 constant bit[16] led_seven_seg_hex_d = 16b_0111101101101101 "Which hex values require lighting of LED segment D";
27 constant bit[16] led_seven_seg_hex_e = 16b_1111110101000101 "Which hex values require lighting of LED segment E";
28 constant bit[16] led_seven_seg_hex_f = 16b_1101111101110001 "Which hex values require lighting of LED segment F";
29 constant bit[16] led_seven_seg_hex_g = 16b_1110111101111100 "Which hex values require lighting of LED segment G";
30 
31 /*a Types */
32 /*t t_led_ws2812_data
33  *
34  * LED data response to the led_ws2812_chain module, indicating the
35  * 24-bit RGB value for the @a led_number'th LED in the chain
36  *
37  */
38 typedef struct {
39  bit valid "Assert if the LED data supplied in this structure is valid";
40  bit last "Assert if the LED data is for the last LED in the chain";
41  bit[8] red "The 8 bit red component for the LED to display";
42  bit[8] green "The 8 bit green component for the LED to display";
43  bit[8] blue "The 8 bit blue component for the LED to display";
45 
46 /*t t_led_ws2812_request
47  *
48  * Request from the led_ws2812_chain module to ask for the color data
49  * for a particular LED in the LED chain
50  */
51 typedef struct {
52  bit ready "Active high signal indicating if LED data is required; ignore @a ready if the response has @a valid asserted";
53  bit first "If requesting LED data, then the first LED of the stream should be provided; indicates @a led_number is 0";
54  bit[8] led_number "Number of LED data required, so that a client can use a switch statement or register file or array, for example";
56 
57 /*a Modules */
58 /*m led_seven_segment*/
59 extern module led_seven_segment( input bit[4] hex "Hexadecimal to display on 7-segment LED",
60  output bit[7] leds "1 for LED on, 0 for LED off, for segments a-g in bits 0-7"
61  )
62 {
63  timing comb input hex;
64  timing comb output leds;
65 }
66 
67 /*m led_ws2812_chain*/
68 extern module led_ws2812_chain( clock clk "system clock - not the pin clock",
69  input bit reset_n "async reset",
70  input bit[8] divider_400ns "clock divider value to provide for generating a pulse every 400ns based on clk",
71  output t_led_ws2812_request led_request "LED data request",
72  input t_led_ws2812_data led_data "LED data, for the requested led",
73  output bit led_chain "Data in pin for LED chain"
74  )
75 {
76  timing to rising clock clk divider_400ns, led_data;
77  timing from rising clock clk led_request, led_chain;
78 }
constant bit[16] led_seven_seg_hex_b
Definition: leds.h:24
Definition: leds.h:38
constant bit[16] led_seven_seg_hex_a
Definition: leds.h:23
constant bit[16] led_seven_seg_hex_d
Definition: leds.h:26
constant bit[16] led_seven_seg_hex_f
Definition: leds.h:28
Definition: leds.h:51
constant bit[8] divider_400ns
Definition: bbc_micro_de1_cl_io.cdl:38
constant bit[16] led_seven_seg_hex_e
Definition: leds.h:27
module led_seven_segment(input bit[4] hex, output bit[7] leds)
Definition: leds.h:59
module led_ws2812_chain(clock clk, input bit reset_n, input bit[8] divider_400ns, output t_led_ws2812_request led_request, input t_led_ws2812_data led_data, output bit led_chain)
Definition: leds.h:68
constant bit[16] led_seven_seg_hex_g
Definition: leds.h:29
constant bit[16] led_seven_seg_hex_c
Definition: leds.h:25