AMBA——AHB slave设计实践

本文探讨了在AMBA高级总线接口(AHB)协议下,设计从设备(Slave)的过程。着重讲解如何利用GlueLogic进行连接,并详细阐述了在地址周期和数据周期中,如何采样和处理控制信号,特别是在读写操作中的关键步骤。同时,提到了Calc模块以及相关的测试代码和Testcase脚本,以确保设计的正确性。
摘要由CSDN通过智能技术生成

 

 

 

 

GlueLogic : TOP层只有连线,与门就是一个gluelogic

TOP层

module ahb_calc_top(
                      //input singals
                       hclk,
                       hresetn,
                       hsel,
                       hwrite,
                       hready,
                       hsize,
                       htrans,
                       hburst,
                       hwdata,
                       haddr,

                       //output singals
                       hresp,
                       hready_resp,            
                       hrdata
                     );


 input          hclk;
 input          hresetn;
 input          hsel;
 input          hwrite;
 input          hready;
 input [2:0]    hsize;
 input [1:0]    htrans;
 input [2:0]    hburst;
 input [31:0]   hwdata;
 input [31:0]   haddr;


 output         hready_resp;
 output[1:0]    hresp;
 output[31:0]   hrdata;

 wire           ctrl;
 wire  [1:0]    calc_mode;
 wire  [15:0]   opcode_a;
 wire  [15:0]   opcode_b;
 wire  [31:0]   result;



ahb_slave_calc U_slave_if(
                       .hclk              (hclk       ),
                       .hresetn           (hresetn    ),
                       .hsel              (hsel       ),
                       .hwrite            (hwrite     ),
                       .hready            (hready     ),
                       .hsize             (hsize      ),
                       .htrans            (htrans     ),
                       .hburst            (hburst     ), 
                       .hwdata            (hwdata     ),
                       .haddr             (haddr      ),
                       .result            (result     ),
                       .hready            (hready     ),
                       .hready_resp       (hready_resp),
                       .hresp             (hresp      ),
                       .hrdata            (hrdata     ),
                       .ctrl              (ctrl       ),
                       .calc_mode         (calc_mode  ),
                       .opcode_a          (opcode_a   ),
                       .opcode_b          (opcode_b   )
                     );


calc U_calc(
          .ctrl      (ctrl      ),
          .calc_mode (calc_mode ),
          .opcode_a  (opcode_a  ),
          .opcode_b  (opcode_b  ),
          .result    (result    )
          );

endmodule                     

 Slave

module ahb_slave_calc(
                       //input signals
                       hclk,
                       hresetn,
                       hsel,
                       hwrite,
                       hready,
                       hsize,
                       htrans,
                       hburst,
                       hwdata,
                       haddr,
                       
                       result,
                       //output signal
                       
                       hready_resp, 
                       hresp,
                       hrdata,
                       ctrl,
                       calc_mode,
                       opcode_a,
                       opcode_b
                     );
//two response,one is of bus read and write response,the other is hready response to gvie  bus

 input          hclk;
 input          hresetn;
 input          hsel;
 input          hwrite;
 input          hready;
 input [2:0]    hsize;
 input [1:0]    htrans;
 input [2:0]    hburst;
 input [31:0]   hwdata;
 input [31:0]   haddr;
 
 input [31:0]   result;
 
 output         hready_resp;
 output[1:0]    hresp
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值