CDL Modules
|
Files | |
file | apb_processor.cdl |
Pipelined APB request/response master, driven by a ROM. | |
module apb_processor::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 | rom_data[40] | ||
) |
The module is presented with a request to execute a program from the ROM starting at a certain address. It executes the program, and hence a set of APB requests, as required.
The purpose of the module is to permit programmed sequences of APB transactions without a full-fledge microcontroller being needed, even for PLL setup or DDR pin DLL scanning, and so on.
A request to run a program is an address with a valid bit; if a valid request is presented, it should be held until acknowledge. The module will acknowledge a request using a single cycle acknowledge in its apb_processor_response
. Then the module will start reading the ROM at the given address, executing 'APB program instructions' from the data returned. The ROM is external to this module, and hence the rom_request
and rom_data
signals permit a simple synchronous memory to be attached with the program data.
A second request to run a program may be presented while the APB processor module is busy with the previous program request; this is perfectly acceptable, but there will not be an acknowledge until the APB processor is ready to start the new program; the new request should be held stable until that point.
The ROM contains the APB program, which is 40 bits of data per instruction - 8 bits of opcode, 32 bits of data, per word. The opcode is in [8;32], and the operand data is in [32;0].
The opcodes fall in to 6 different classes: ALU, branch, set parameter, APB request, wait, finish.
ALU
Five ALU ops are supported - OR, BIC, AND, XOR, ADD
Branch
Four branch types are supported - always, if acc is zero, if acc is nonzero, and if repeat count is nonzero (with the side effect of decrementing the repeat count)
Set parameter
Set parameter can set the APB address, accumulator and repeat count
Wait
Wait uses the accumulator, decrementing it once per cycle, to wait before moving on in the program.
APB request
APB request can request read, write accumulator, or write using the ROM content as data; these can optionally also auto-increment the address
Finish
Complete the program, and permit a new request to be started
The module presents a registered APB request interface out, and accepts an APB response back, including pready.
[in] | clk | Clock for the CSR interface; a superset of all targets clock |
[in] | reset_n | Active low reset |
[in] | apb_processor_request | Request from the client to execute from an address in the ROM |
[out] | apb_processor_response | Response to the client acknowledging a request |
[out] | apb_request | Pipelined csr request interface output |
[in] | apb_response | Pipelined csr request interface response |
[out] | rom_request | Request to the instruction ROM for reading, with address |
[in] | rom_data | Read data back from the ROM with the APB program instruction |