ahb2apb和apb2apb async bridge
AHB 3.0目前不支持security world.
AHB到APB的async bridge主要包括三个部分:
1)AHB domain
1)产生信号hactive = HSEL & HTRANS[1];新的传输地址有效
HTRANS的第一位表示一个新的seq或者连续的transfer
HTARNS的第零位表示一个idle或busy的transfer
用ahb的clock,寄存一拍
always @(posedge HCLK or negedge HRESETn)
if(!RESETn)
else if(HREADYin)
ahb_active = hactive
2)产生信号haccess = HREADYin & hactive;可以接受数据传输
HREADYin信号表示slave已经ready。
用ahb的clock,寄存一拍
always @(posedge HCLK or negedge HRESETn)
if(!RESETn)
else ahb_access = haccess
3)用ahb的clock,寄存write和addr
always @(posedge HCLK or negedge HRESETn)
if(!RESETn)
else if(haccess)
ahb_write = HWRITE
ahb_addr = HADDR
4)用ahb的clock,寄存wdata
产生信号ahb_wdata_ld = ahb_access & ahb_write
always @(posedge HCLK or negedge HRESETn)
if(!RESETn)
else if(ahb_wdata_ld)
ahb_wdata = HWDATA
5)产生信号HREADYout = ~ahb_active|apb_ack_pls
产生信号HRDATA = apb_rdata
2)AHB clock domain和APB clock domain的handshake
根据ahb_access信号,产生ahb_req信号,同时在apb_clk domain中进行sync
always @(posedge HCLK or negedge HRESETn)
if(!RESETn)
else if(ahb_access)
ahb_req = ~ahb_req
always @(posedge PCLK or negedge PRESETn)
if(!RESETn)
else
ahb_req_sync1 = ahb_req
ahb_req_sync2 = ahb_req_sync1
ahb_req_sync3 = ahb_req_sync2
ahb_req_pls = ahb_req_sync2^ahb_req_sync3
根据ahb_reg_pls_d信号,产生ahb_ack信号,同时在ahb_clk domain中进行sync
always @(posedge PCLK or negedge PRESETn)
if(!RESETn)
else if(ahb_reg_pls_d)
ahb_ack = ~ahb_ack
always @(posedge HCLK or negedge HRESETn)
if(!RESETn)
else
ahb_ack_sync1 = ahb_ack
ahb_ack_sync2 = ahb_ack_sync1
ahb_ack_sync3 = ahb_ack_sync2
ahb_ack_pls = ahb_ack_sync2^ahb_ack_sync3
3)APB domain
寄存ahb_req_pls一拍
always @(posedge PCLK or negedge PRESETn)
if(!RESETn)
else ahb_req_pls_d = ~ahb_req_pls
PWRITE/PADDR/PWDATA 直接连接到AHB的reg中,
PSEL = ahb_req_pls | ahb_req_pls_d
PENABLE = ahb_req_pls_d
apb_rdata的赋值
apb_rdata_ld = ahb_req_pls_d & ~ahb_write
always @(posedge HCLK or negedge HRESETn)
if(!RESETn)
else if(apb_rdata_ld)
apb_rdata = PRDATA
apb2apb的async bridge:
1)req由master端产生,在enable阶段有效,传递到slave端,有效一个cycle,用来锁存master端的addr/strb/data信号到slave的寄存器中。
2)ack信号由slave端产生,在sready有效且enable有效情况下产生。有效一个cycle,锁存rdata和resp。
3)Latch表示只含有if()的always模块,被综合为带clock gate的FF.