I have the following doubts in AMBA 3 APB v1.0
1) How the APB slave generate PREADY is high /low?
2)What are all the factors APB slave have to consider while generating the PREADY is high /zero? Eg) PSELx, PENABLE, states etc
3) in figure 2-2,During the right transfer with wait states ,PSELx and PENABLE is high PREADY is low for 2 clock period. Why PREADY is low for 2 clock ? (ref Figure 2-2 Write transfer with wait states)
4)how to check the write /read transfer with wait states on simulation ?
5)in access state at what condition PREADY will be low ?
FYI, the link to AMAB 3 APB v1.0 is developer.arm.com/.../
I am not an AMBA bus protocol expert but as far as I know
1) PREADY is an indication of transfer status from the APB slave
If the APB slave cannot indicate end of the transfer for some circumstances e.g. there is some latency from the designated storage (memory or register) inside the APB slave to the bus, it can keep PREADY low until the write data is written or the read data is ready. This is so called wait state insertion.
3) That is because there is some reason that the APB slave cannot indicate the acknowledge of the write for two clocks so it inserts two wait states. It may be a latency or it may be that the APB slave is being busy for internal operation in the APB slave. It totally depends on the APB slave functionality or implementation. If there is no reason that prevents the data from being written into the designated area, the APB slave doesn't have to insert wait states.
4) I am not sure if I fully understand your question but if you want to detect wait states on the bus in the simulation, you can catch it with the pseudo Verilog code below.
always @(posedge PCLK) begin
if (PSEL == 1'b1 && PENABLE == 1'b1 && PREADY == 1'b0) begin
if (PWRITE == 1'b1) begin
$display("Detected WRITE wait state at %d", $time);
end else begin
$display("Detected READ wait state at %d", $time);
5) Again, I may not fully understand your question but only the mandatory case is when the APB slave needs to insert wait states because of its own reason that I previously mentioned. In other words, if there is no case that the APB slave inserts wait states (i.e. transfers can always be done with no wait states), PREADY can be tied HIGH permanently in the system. See Figure 2-1. Please note that you can deassert PREADY when PSEL is LOW or PENABLE is LOW but this isn't mandatory so this is just flavor of designer's choice e.g. you may want to explicitly deassert PREADY for debugging purpose (because whenever you see PREADY HIGH on simulation waveform, you can notice there is a transfer).
Apologies - I've noticed the first IF statement in #4 wasn't correct so I've corrected
if (PSEL == 1'b1 && PENABLE == 1'b1) begin
My original post has been corrected, too.
Thank you Toshihisa Oishi .Now i understood . IHI 0024C AMBA® APB ProtocolVersion: 2.0 gives more clarity about PREADY signal .
Thank you Dheeran for the feedback. It's useful information that v2.0 give more clarity about PREADY signal.Just for future reference for other people in Community, below is the link to AMBA APB Protocol Specification Version 2.0 (aka Version C).