CDL Modules
apb_peripherals.h
Go to the documentation of this file.
1 
22 /*a Includes */
23 include "apb.h"
24 include "timer.h"
25 include "axi.h"
26 include "dprintf.h"
27 include "srams.h"
28 include "de1_cl.h"
29 
30 /*a Modules */
31 /*a Modules - see also csr_target_apb, csr_master_apb in csr_interface.h */
32 /*m apb_master_mux
33  *
34  * Multiplex two APB masters on to a single APB master bus
35  *
36  */
37 extern
38 module apb_master_mux( clock clk "System clock",
39  input bit reset_n "Active low reset",
40 
41  input t_apb_request apb_request_0 "APB request to master 0",
42  output t_apb_response apb_response_0 "APB response to master 0",
43 
44  input t_apb_request apb_request_1 "APB request to master 1",
45  output t_apb_response apb_response_1 "APB response to master 1",
46 
47  output t_apb_request apb_request "APB request to targets",
48  input t_apb_response apb_response "APB response from targets"
49  )
50 {
51  timing to rising clock clk apb_request_0, apb_request_1;
52  timing from rising clock clk apb_response_0, apb_response_1;
53  timing from rising clock clk apb_request;
54  timing to rising clock clk apb_response;
55 }
56 
57 /*m apb_master_axi
58  *
59  * APB master driven by an AXI target (32-bit address, 64-bit data)
60  *
61  * Supports aligned 32-bit single length transactions only
62  *
63  */
64 extern
65 module apb_master_axi( clock aclk,
66  input bit areset_n,
67  input t_axi_request ar,
68  output bit awready,
69  input t_axi_request aw,
70  output bit arready,
71  output bit wready,
72  input t_axi_write_data w,
73  input bit bready,
74  output t_axi_write_response b,
75  input bit rready,
76  output t_axi_read_response r,
77 
78  output t_apb_request apb_request,
79  input t_apb_response apb_response
80  )
81 {
82  timing to rising clock aclk ar, aw, w, bready, rready;
83  timing from rising clock aclk awready, arready, wready, b, r;
84  timing from rising clock aclk apb_request;
85  timing to rising clock aclk apb_response;
86 }
87 
88 /*m apb_processor */
89 extern
90 module apb_processor( clock clk "Clock for the CSR interface; a superset of all targets clock",
91  input bit reset_n,
92  input t_apb_processor_request apb_processor_request,
93  output t_apb_processor_response apb_processor_response,
94  output t_apb_request apb_request "Pipelined csr request interface output",
95  input t_apb_response apb_response "Pipelined csr request interface response",
96  output t_apb_rom_request rom_request,
97  input bit[40] rom_data
98  )
99 {
100  timing to rising clock clk apb_processor_request;
101  timing from rising clock clk apb_processor_response;
102  timing from rising clock clk apb_request, rom_request;
103  timing to rising clock clk apb_response, rom_data;
104 }
105 
106 /*m apb_target_timer */
107 extern module apb_target_timer( clock clk "System clock",
108  input bit reset_n "Active low reset",
109 
110  input t_apb_request apb_request "APB request",
111  output t_apb_response apb_response "APB response",
112 
113  output bit[3] timer_equalled
114  )
115 {
116  timing to rising clock clk apb_request;
117  timing from rising clock clk apb_response, timer_equalled;
118 
119  timing comb input apb_request;
120  timing comb output apb_response; // since response depends on request address usually
121 }
122 
123 /*m apb_target_rv_timer */
124 extern
125 module apb_target_rv_timer( clock clk "System clock",
126  input bit reset_n "Active low reset",
127  input t_timer_control timer_control "Control of the timer",
128 
129  input t_apb_request apb_request "APB request",
130  output t_apb_response apb_response "APB response",
131 
132  output t_timer_value timer_value
133  )
134 {
135  timing to rising clock clk apb_request, timer_control;
136  timing from rising clock clk apb_response, timer_value;
137 }
138 
139 /*m apb_target_gpio */
140 extern module apb_target_gpio( clock clk "System clock",
141  input bit reset_n "Active low reset",
142 
143  input t_apb_request apb_request "APB request",
144  output t_apb_response apb_response "APB response",
145 
146  output bit[16] gpio_output,
147  output bit[16] gpio_output_enable,
148  input bit[16] gpio_input,
149  output bit gpio_input_event
150  )
151 {
152  timing to rising clock clk apb_request;
153  timing from rising clock clk apb_response;
154  timing from rising clock clk gpio_output, gpio_output_enable, gpio_input_event;
155  timing to rising clock clk gpio_input;
156 }
157 
158 /*m apb_target_sram_interface */
159 extern
160 module apb_target_sram_interface( clock clk "System clock",
161  input bit reset_n "Active low reset",
162 
163  input t_apb_request apb_request "APB request",
164  output t_apb_response apb_response "APB response",
165 
166  output bit[32] sram_ctrl "SRAM control for whatever purpose",
167 
168  output t_sram_access_req sram_access_req "SRAM access request",
169  input t_sram_access_resp sram_access_resp "SRAM access response"
170  )
171 {
172  timing to rising clock clk apb_request;
173  timing from rising clock clk apb_response;
174  timing from rising clock clk sram_access_req, sram_ctrl;
175  timing to rising clock clk sram_access_resp;
176 }
177 
178 /*m apb_target_dprintf */
179 extern module apb_target_dprintf( clock clk "System clock",
180  input bit reset_n "Active low reset",
181 
182  input t_apb_request apb_request "APB request",
183  output t_apb_response apb_response "APB response",
184 
185  output t_dprintf_req_4 dprintf_req,
186  input bit dprintf_ack
187  )
188 {
189  timing to rising clock clk apb_request;
190  timing from rising clock clk apb_response;
191 
192  timing from rising clock clk dprintf_req;
193  timing to rising clock clk dprintf_ack;
194 
195 }
196 
197 /*m apb_target_led_ws2812 */
198 extern
199 module apb_target_led_ws2812( clock clk "System clock",
200  input bit reset_n "Active low reset",
201 
202  input t_apb_request apb_request "APB request",
203  output t_apb_response apb_response "APB response",
204 
205  input bit[8] divider_400ns_in "Default value for divider_400ns",
206 
207  output bit led_chain
208  )
209 {
210  timing to rising clock clk apb_request;
211  timing from rising clock clk apb_response;
212 
213  timing from rising clock clk led_chain;
214  timing to rising clock clk divider_400ns_in;
215 
216 }
217 
218 /*m apb_target_de1_cl_inputs */
219 extern
220 module apb_target_de1_cl_inputs( clock clk "System clock",
221  input bit reset_n "Active low reset",
222 
223  input t_apb_request apb_request "APB request",
224  output t_apb_response apb_response "APB response",
225 
226  input t_de1_cl_user_inputs user_inputs
227  )
228 {
229  timing to rising clock clk apb_request;
230  timing from rising clock clk apb_response;
231 
232  timing to rising clock clk user_inputs;
233 
234 }
235 
236 /*m apb_target_ps2_host */
237 extern
238 module apb_target_ps2_host( clock clk "System clock",
239  input bit reset_n "Active low reset",
240 
241  input t_apb_request apb_request "APB request",
242  output t_apb_response apb_response "APB response",
243 
244  input t_ps2_pins ps2_in "Pin values from the outside",
245  output t_ps2_pins ps2_out "Pin values to drive - 1 means float high, 0 means pull low"
246  )
247 {
248  timing to rising clock clk apb_request;
249  timing from rising clock clk apb_response;
250 
251  timing to rising clock clk ps2_in;
252  timing from rising clock clk ps2_out;
253 }
254 
255 /*a Editor preferences and notes
256 mode: c ***
257 c-basic-offset: 4 ***
258 c-default-style: (quote ((c-mode . "k&r") (c++-mode . "k&r"))) ***
259 outline-regexp: "/\\\*a\\\|[\t ]*\/\\\*[b-z][\t ]" ***
260 */
261 
262 
Definition: dprintf.h:27
module apb_processor(clock clk, input bit reset_n, input t_apb_processor_request apb_processor_request, output t_apb_processor_response apb_processor_response, output t_apb_request apb_request, input t_apb_response apb_response, output t_apb_rom_request rom_request, input bit[40] rom_data)
Definition: apb_peripherals.h:90
Definition: axi.h:81
Definition: axi.h:55
module apb_target_led_ws2812(clock clk, input bit reset_n, input t_apb_request apb_request, output t_apb_response apb_response, input bit[8] divider_400ns_in, output bit led_chain)
Definition: apb_peripherals.h:199
module apb_target_sram_interface(clock clk, input bit reset_n, input t_apb_request apb_request, output t_apb_response apb_response, output bit[32] sram_ctrl, output t_sram_access_req sram_access_req, input t_sram_access_resp sram_access_resp)
Definition: apb_peripherals.h:160
Definition: apb.h:48
Definition: apb.h:42
Definition: input_devices.h:137
Definition: apb.h:26
module apb_target_timer(clock clk, input bit reset_n, input t_apb_request apb_request, output t_apb_response apb_response, output bit[3] timer_equalled)
Definition: apb_peripherals.h:107
Definition: de1_cl.h:82
module apb_target_gpio(clock clk, input bit reset_n, input t_apb_request apb_request, output t_apb_response apb_response, output bit[16] gpio_output, output bit[16] gpio_output_enable, input bit[16] gpio_input, output bit gpio_input_event)
Definition: apb_peripherals.h:140
module apb_target_rv_timer(clock clk, input bit reset_n, input t_timer_control timer_control, input t_apb_request apb_request, output t_apb_response apb_response, output t_timer_value timer_value)
Definition: apb_peripherals.h:125
Definition: timer.h:39
Definition: apb.h:54
Definition: apb.h:35
module apb_target_dprintf(clock clk, input bit reset_n, input t_apb_request apb_request, output t_apb_response apb_response, output t_dprintf_req_4 dprintf_req, input bit dprintf_ack)
Definition: apb_peripherals.h:179
module apb_master_axi(clock aclk, input bit areset_n, input t_axi_request ar, output bit awready, input t_axi_request aw, output bit arready, output bit wready, input t_axi_write_data w, input bit bready, output t_axi_write_response b, input bit rready, output t_axi_read_response r, output t_apb_request apb_request, input t_apb_response apb_response)
Definition: apb_peripherals.h:65
Definition: axi.h:92
Definition: srams.h:34
module apb_master_mux(clock clk, input bit reset_n, input t_apb_request apb_request_0, output t_apb_response apb_response_0, input t_apb_request apb_request_1, output t_apb_response apb_response_1, output t_apb_request apb_request, input t_apb_response apb_response)
Definition: apb_peripherals.h:38
module apb_target_de1_cl_inputs(clock clk, input bit reset_n, input t_apb_request apb_request, output t_apb_response apb_response, input t_de1_cl_user_inputs user_inputs)
Definition: apb_peripherals.h:220
module apb_target_ps2_host(clock clk, input bit reset_n, input t_apb_request apb_request, output t_apb_response apb_response, input t_ps2_pins ps2_in, output t_ps2_pins ps2_out)
Definition: apb_peripherals.h:238
Definition: axi.h:71
Definition: timer.h:27
Definition: srams.h:23