CDL Modules
bbc_csr_interface

Detailed Description

Modules

module bbc_csr_interface::bbc_csr_interface ( clock  clk,
input bit  reset_n,
input t_bbc_csr_request  csr_request,
output t_bbc_csr_response  csr_response,
output t_bbc_csr_access  csr_access,
input t_bbc_csr_access_data  csr_read_data,
input bit  csr_select[16] 
)

This CSR interface is designed to provide a simple CSR access (select, read/write, address, data) to a client from a pipelined request from a master.

The initial design motiviation was to permit a pipelined CSR access from a master to a number of targets, to run off a single fast clock in an FPGA. This requires registering the read data in response to access requests, and registering the request to the targets; the simplest variant being a fixed latency master-to-target and a fixed latency target-to-master. The current design uses a valid/acknowledgement system to replace the fixed latency.

A valid request is received, and if it matches the field then the request is acknowledged. Since the master is a fair distance away, and the signal will not be removed until an is seen, the handshake is effectively: valid low, ack low; valid high, ack low; valid high, ack high; valid high, ack low; valid low, ack low.

Hence a valid request starts with valid high in, and ack out low. If this matches the select, then this interface responds with a single cycle of ack high, and the CSR access is performed.

The clock for the client must be based on the same clock as the master. However, it may be a derived clock - in which case the ack will appear to the master to be more than one clock cycle long. The master must manage this, by removing valid when it sees the ack, and waiting until it sees ack is low before starting another transaction.

Read transactions have a further stage, though, compared to writes. A read transaction will follow an 'ack' with a 'read_data_valid' cycle; if a master performs a read then the handshake will be: valid low, ack low; valid high, ack low; valid high, ack high (one target cycle); valid high, ack low, read_data_valid high (one target cycle); valid low, ack low.

In this case the master must again wait until it sees read_data_valid high and then low before starting a new transaction, to allow the target to use a derived clock.

Parameters
[in]clkClock for the CSR interface
[in]csr_requestPipelined csr request interface input
[out]csr_responsePipelined csr request interface response
[out]csr_accessRegistered CSR access request to client
[in]csr_read_dataRead data valid combinatorially based on csr_access
[in]csr_selectHard-wired select value for the client