CDL Modules
de1_cl.h
Go to the documentation of this file.
1 
22 /*a Includes */
23 include "bbc_micro_types.h"
24 include "csr_interface.h"
25 include "input_devices.h"
26 
27 /*a Types */
28 /*t t_de1_cl_inputs_control */
29 typedef struct {
30  bit sr_clock """Not really a clock in the FPGA, but a signal toggled by the design""";
31  bit sr_shift """Asserted high for rising sr_clock to shift the shift register; if low, the shift register is loaded from the pins""";
33 
34 /*t t_rotary_motion_inputs */
35 typedef struct {
39 
40 /*t t_de1_cl_inputs_status */
41 typedef struct {
42  bit sr_data """Shift register output data""";
46 
47 /*t t_de1_cl_diamond */
48 typedef struct {
49  bit a; // bottom of diamond
50  bit b; // right of diamond
51  bit x; // left of diamond
52  bit y; // top of diamond
54 
55 /*t t_de1_cl_joystick */
56 typedef struct {
57  bit u;
58  bit d;
59  bit l;
60  bit r;
61  bit c;
63 
64 /*t t_de1_cl_shift_register */
65 typedef struct {
73 
74 /*t t_de1_cl_rotary */
75 typedef struct {
76  bit pressed;
77  bit direction;
80 
81 /*t t_de1_cl_user_inputs */
82 typedef struct {
83  bit updated_switches "Asserted if diamond, joystick, touchpanel_irq, temperature_alarm, and dial pressed bits have been updated";
91 
92 /*t t_de1_cl_lcd */
93 typedef struct {
94  bit vsync_n;
95  bit hsync_n;
97  bit[6] red;
98  bit[7] green;
99  bit[6] blue;
101 } t_de1_cl_lcd;
102 
103 /*t t_de1_cl_shift_register_control */
104 typedef struct {
105  bit sr_clock;
106  bit sr_shift;
108 
109 extern module de1_cl_controls( clock clk "system clock - not the shift register pin, something faster",
110  input bit reset_n "async reset",
111  output t_de1_cl_inputs_control inputs_control "Signals to the shift register etc on the DE1 CL daughterboard",
112  input t_de1_cl_inputs_status inputs_status "Signals from the shift register, rotary encoders, etc on the DE1 CL daughterboard",
113  output t_de1_cl_user_inputs user_inputs "",
114  input bit[8] sr_divider "clock divider to control speed of shift register"
115  )
116 {
117  timing to rising clock clk inputs_status, sr_divider;
118  timing from rising clock clk inputs_control, user_inputs;
119 }
120 
121 /*t t_de1_leds */
122 typedef struct {
123  bit[10] leds;
124  bit[7] h0;
125  bit[7] h1;
126  bit[7] h2;
127  bit[7] h3;
128  bit[7] h4;
129  bit[7] h5;
130 } t_de1_leds;
131 
132 /*a Modules */
133 /*m bbc_micro_de1_cl_bbc */
134 extern
135 module bbc_micro_de1_cl_bbc( clock clk "50MHz clock from DE1 clock generator",
136  clock video_clk "9MHz clock from PLL, derived from 50MHz",
137  input bit reset_n "hard reset from a pin - a key on DE1",
138  input bit bbc_reset_n,
139  input bit framebuffer_reset_n,
140  output t_bbc_clock_control clock_control,
141  input t_bbc_keyboard bbc_keyboard,
142  output t_video_bus video_bus,
143  input t_csr_request csr_request,
144  output t_csr_response csr_response
145  )
146 {
147  timing from rising clock clk clock_control;
148  timing to rising clock clk bbc_keyboard, csr_request;
149  timing from rising clock clk csr_response;
150  timing from rising clock video_clk video_bus;
151 }
152 
153 /*m bbc_micro_de1_cl_io */
154 extern
155 module bbc_micro_de1_cl_io( clock clk "50MHz clock from DE1 clock generator",
156  clock video_clk "9MHz clock from PLL, derived from 50MHz",
157  input bit reset_n "hard reset from a pin - a key on DE1",
158  input bit bbc_reset_n,
159  input bit framebuffer_reset_n,
160  input bit[4] keys,
161  input bit[10] switches,
162  input t_bbc_clock_control clock_control,
163  output t_bbc_keyboard bbc_keyboard,
164  output t_video_bus video_bus,
165  output t_csr_request csr_request,
166  input t_csr_response csr_response,
167  input t_ps2_pins ps2_in "PS2 input pins",
168  output t_ps2_pins ps2_out "PS2 output pin driver open collector",
169  input t_de1_cl_inputs_status inputs_status "DE1 CL daughterboard shifter register etc status",
170  output t_de1_cl_inputs_control inputs_control "DE1 CL daughterboard shifter register control",
171  output bit[10] leds,
172  output bit lcd_source,
173  output bit led_chain
174  )
175 {
176  timing to rising clock clk clock_control;
177  timing to rising clock clk keys, switches;
178  timing from rising clock clk lcd_source, leds;
179  timing from rising clock clk bbc_keyboard, csr_request;
180  timing to rising clock clk csr_response;
181  timing from rising clock video_clk video_bus;
182  timing to rising clock clk ps2_in, inputs_status;
183  timing from rising clock clk ps2_out, inputs_control, led_chain;
184 }
bit sr_clock
Definition: de1_cl.h:105
Definition: de1_cl.h:93
bit vsync_n
Definition: de1_cl.h:94
module bbc_micro_de1_cl_bbc(clock clk, clock video_clk, input bit reset_n, input bit bbc_reset_n, input bit framebuffer_reset_n, output t_bbc_clock_control clock_control, input t_bbc_keyboard bbc_keyboard, output t_video_bus video_bus, input t_csr_request csr_request, output t_csr_response csr_response)
Definition: de1_cl.h:135
Definition: bbc_micro_types.h:269
t_rotary_motion_inputs right_rotary
Definition: de1_cl.h:44
bit y
Definition: de1_cl.h:52
bit direction_pulse
Definition: de1_cl.h:78
Definition: csr_interface.h:61
bit[7] h4
Definition: de1_cl.h:128
t_de1_cl_rotary left_dial
Definition: de1_cl.h:86
t_de1_cl_joystick joystick
Definition: de1_cl.h:85
bit a
Definition: de1_cl.h:49
Definition: csr_interface.h:82
bit[6] red
Definition: de1_cl.h:97
Definition: de1_cl.h:35
bit b
Definition: de1_cl.h:50
Definition: input_devices.h:137
bit[7] green
Definition: de1_cl.h:98
bit[7] h3
Definition: de1_cl.h:127
t_de1_cl_diamond diamond
Definition: de1_cl.h:84
Definition: de1_cl.h:82
bit[10] leds
Definition: de1_cl.h:123
bit dialr_click
Definition: de1_cl.h:69
Definition: de1_cl.h:75
bit x
Definition: de1_cl.h:51
bit backlight
Definition: de1_cl.h:100
bit direction_pin
Definition: de1_cl.h:36
t_de1_cl_joystick joystick
Definition: de1_cl.h:68
bit touchpanel_irq
Definition: de1_cl.h:67
bit[7] h1
Definition: de1_cl.h:125
bit[7] h5
Definition: de1_cl.h:129
bit u
Definition: de1_cl.h:57
bit touchpanel_irq
Definition: de1_cl.h:88
constant bit[8] sr_divider
Definition: bbc_micro_de1_cl_io.cdl:37
bit display_enable
Definition: de1_cl.h:96
bit temperature_alarm
Definition: de1_cl.h:71
Definition: de1_cl.h:56
bit c
Definition: de1_cl.h:61
Definition: de1_cl.h:41
bit temperature_alarm
Definition: de1_cl.h:89
bit pressed
Definition: de1_cl.h:76
Definition: de1_cl.h:48
bit l
Definition: de1_cl.h:59
bit[6] blue
Definition: de1_cl.h:99
bit d
Definition: de1_cl.h:58
Definition: video.h:36
bit hsync_n
Definition: de1_cl.h:95
bit r
Definition: de1_cl.h:60
Definition: de1_cl.h:122
Definition: de1_cl.h:104
bit sr_shift
Definition: de1_cl.h:106
t_de1_cl_diamond diamond
Definition: de1_cl.h:66
Definition: bbc_micro_types.h:41
bit transition_pin
Definition: de1_cl.h:37
bit[7] h0
Definition: de1_cl.h:124
t_rotary_motion_inputs left_rotary
Definition: de1_cl.h:43
module de1_cl_controls(clock clk, input bit reset_n, output t_de1_cl_inputs_control inputs_control, input t_de1_cl_inputs_status inputs_status, output t_de1_cl_user_inputs user_inputs, input bit[8] sr_divider)
Definition: de1_cl.h:109
Definition: de1_cl.h:65
Definition: de1_cl.h:29
t_de1_cl_rotary right_dial
Definition: de1_cl.h:87
bit direction
Definition: de1_cl.h:77
bit[7] h2
Definition: de1_cl.h:126
bit diall_click
Definition: de1_cl.h:70
module bbc_micro_de1_cl_io(clock clk, clock video_clk, input bit reset_n, input bit bbc_reset_n, input bit framebuffer_reset_n, input bit[4] keys, input bit[10] switches, input t_bbc_clock_control clock_control, output t_bbc_keyboard bbc_keyboard, output t_video_bus video_bus, output t_csr_request csr_request, input t_csr_response csr_response, input t_ps2_pins ps2_in, output t_ps2_pins ps2_out, input t_de1_cl_inputs_status inputs_status, output t_de1_cl_inputs_control inputs_control, output bit[10] leds, output bit lcd_source, output bit led_chain)
Definition: de1_cl.h:155