目录
- 1. Function Description
- 2. Feature List
- 3. Block Diagram
- 4. Interface Description
- 5. Timing Description
- 5. Finite State Machine Description
- 5. Pipeline Description
- 5. Pingpong Description
- (6. Register Description)
- (7. Command Description)
- 8. Submodule Design
- 9. RTL coding
- 10. Testbench coding
- 12. Verification
旨在总结工作和练习中常用的算法设计方法,以下框架遵循一个子系统的设计流程。
1. Function Description
按照:综述→时序/状态机/流水过程→寄存器→子功能→接口协议的框架介绍模块,必要时加入时序图、架构图
1.1. Overview
1.2. Timing / Finite State Machine / Pipeline Operation
1.3. Registers
1.4. Function1
1.5. Function2
1.6. Interface protocols
2. Feature List
列表描述要具备的功能和具体指标
● 使用APB接口接受数据,再采用SPI发送出去
● 时钟采用100MHZ
● 具备仲裁和时钟同步功能
● 可实现快速(100kbps)、高速(400kbps)和超速(1Mkbps)变化
3. Block Diagram
基于自顶向下的思路,划分为顶层模块和多个子模块,子模块包括寄存器模块、状态机控制模块、桥模块、其他子模块,作出架构图
下图中top_module_fsm用来对其他子模块进行控制、调度,以实现top_module的正确功能
当然有的架构不需要状态机


4. Interface Description
接口、参数描述
| Group | Signal | Direction | Width(bits) | Description |
|---|---|---|---|---|
| rstn | input | 1 | 复位 | |
| clk | input | 1 | 时钟 | |
| A_intf | cmd1 | input | CMD_WIDTH | 命令1 |
| rsp1 | output | RSP_WIDTH | 响应1 | |
| B_intf | cmd2 | input | CMD_WIDTH | 命令2 |
| rsp2 | output | RSP_WIDTH | 响应2 | |
| ... | ... | input or output | ... | ... |
之后是需要配置的参数描述
| Parameter | Units | Description |
|---|---|---|
| CMD_WIDTH | bit | 命令位宽 |
| RSP_WIDTH | bit | 响应位宽 |
| RSP_GRADE | bit | 响应级别 |
| VELOCITY | bit per second | 执行速率 |
| ... | ... | ... |
5. Timing Description
…
5. Finite State Machine Description
绘制状态机图

6.3 Verilog 状态机
握手时序
RTL协议包拼凑
通用异步收发传输器(Universal Asynchronous Receiver/Transmitter,UART)
RTL仲裁器设计
RTL乒乓运算设计
State1
绘制State1下的时序图
例如

State2
…
State3
…
5. Pipeline Description
作出状态时序图,包括各状态下的逻辑、状态转移条件,并表明数据路径
例如下图,红色箭头表示数据从输入到输出经过的通路
图中的状态转换表示各组信号流水中的状态变换,并非整个模块的状态机变换。
每组信号的状态转移条件可能相同

绘制各状态下的时序图

5. Pingpong Description
待补充
(6. Register Description)
指示某种状态可适用寄存器,按照以下格式绘制
| Offset Address | Register Name | Field(bits) | Access | Field Name | Default Value | Description |
|---|---|---|---|---|---|---|
| 32'h0000_0000 | Receiver Buffer Register | [0] | RW | Validity | 1'b0 | 该寄存器内数据是否有效 |
| [16:1] | RW | Data | 16'd0 | 缓存的数据 | ||
| [31:17] | RW | Reserved | 15'd0 | 保留 | ||
| 32'h0000_0004 | Receiver Shift Register | [7:0] | W | 移位输出 | 8‘d0’ | 用于移位串行输出 |
| [31:8] | RW | Reserved | 'd0 | 保留 | ||
| 32'h0000_0008 | Function Config Register | [1:0] | RW | 波特率控制 | 2‘d0 | 2'd0表示100kbps、2'd1表示400kbps、2'd2表示1Mbps、2'd3表示3.4Mbps |
| [2] | RW | SCL仲裁开关 | 'd0 | 0开启、1关闭 | ||
| [3] | RW | 寻址位数控制 | 'd0 | 0为7bit寻址、1为10bit寻址 | ||
| [5:4] | RW | 充电时间控制 | 'd0 | 'd0为5ns,每增加'd1增加1ns等待时间 | ||
| [31:6] | RW | Reserved | 'd0 | 保留 |
(7. Command Description)
产生某种控制可适用指令,按照以下格式绘制
一般在总线上的某个地址写入某个特定的数据以实现指令,Offset Address表示写地址,Command Code表示写数据,某些指令还需多次写配合完成,Dummy Clock表示该指令距离上一个指令的最小时钟周期。
| Offset Address | Name | Command Code | Min Dummy Clock | Description |
|---|---|---|---|---|
| 0xA0 | Software Enable Reset | 32'h66 | - | Enable reset |
| Software Reset | 32'h99 | 0 | Starts to reset | |
| 0xA4 | Write Register Start | 32'h06 | - | preprocessing command to configure registers |
| 0xA8 | Fixing Data RAM Burst | 32'h02h | - | Starts to write fixing data RAM |
| 32bit RAM address | 10 | Burst start position in RAM | ||
| 32bit RAM data | 0 | First data in RAM | ||
| ... | 0 | data in RAM |
8. Submodule Design
子模块设计,注意要遵循由外到内的顺序设计
8.1. A2top_module_reg_intf
8.1.1. Function Description
8.1.2. Feature List
8.1.3. Block Diagram
7.1.4. Timing Description/FSM Description/Pipeline Description/Pingpong Description
8.1.5. Interface Description
8.1.6. RTL coding
8.1.7. Testbench coding
8.1.8. Verification
8.2. Submodule_D
8.3. top_module_reg
8.4. Submodule_C
8.5. Submodule_B
9. RTL coding
module name(
rstn,
clk,
...,
...
);
//------------------------------------------------------------------------------------------
// parameter declaration
//------------------------------------------------------------------------------------------
parameter ...;
localparam ...;
//------------------------------------------------------------------------------------------
// ports declaration
//------------------------------------------------------------------------------------------
input rstn,
input clk,
//signals group
input ...;
output ...;
//signals group
input ...;
output ...;
//signals group
input ...;
output ...;
//------------------------------------------------------------------------------------------
// blocks instructions...
//------------------------------------------------------------------------------------------
wire ...;
reg ...;
assign ... = ...;
assign ... = ...;
assign ... = ...;
//------------------------------------------------------------------------------------------
// blocks instructions...
//------------------------------------------------------------------------------------------
wire ...;
reg ...;
always@(posedge clk or negedge rstn) begin
if(!rstn)
...
else if(...)
...
end
//------------------------------------------------------------------------------------------
// blocks instructions...
//------------------------------------------------------------------------------------------
wire ...;
reg ...;
module_name#(
.parameter_one (64 ),
.parameter_two (64 ),
.parameter_three (64 )
)instance_name(
.rstn (arstn && rst_fifo ),
.wclk (aclk ),
.wr_en (wr_en_sample_D_FIFO ),
.wdata (wdata_sample_D_FIFO ),
.rclk (aclk ),
.rd_en (rd_en_sample_D_FIFO ),
.rdata (rdata_sample_D_FIFO ),
.valid (rdata_val_sample_D_FIFO ),
.full ( ),
.pfull ( ),
.empty ( )
);
endmodule
10. Testbench coding
…
(10.1. Python reference model)
12. Verification
根据第1节功能描述部分,设计测试用例case,进行仿真验证,并收取覆盖率等信息。
11.1. case1
11.2. case2
11.3. case3
先对该verify case进行语言描述,然后给出输入输出、parameter的设定情况,再给出波形图和log信息,最后总结
本文详述了数字集成电路(IC)设计的RTL设计规范,涵盖功能描述、时序、状态机、流水线操作、接口协议等方面。通过自顶向下的模块划分,包括子模块如A2top_module_reg_intf的设计、测试及验证,同时阐述了测试用例的设置和仿真验证的重要性。
1993

被折叠的 条评论
为什么被折叠?



