使用cocotb开源的项目下的simple_dff例子,执行完make SIM=vcs后,如何查看仿真波形?
时间: 2024-03-31 09:31:56 浏览: 275
执行完`make SIM=vcs`后,会在`sim_build`目录下生成VCS仿真所需的文件和脚本,其中包含了生成波形的相关设置。
要查看仿真波形,可以按照以下步骤进行:
1. 进入`sim_build`目录:`cd sim_build`
2. 启动仿真:`./simv`
3. 在仿真过程中按下`ctrl + c`,终止仿真进程。
4. 生成波形:`dve -vpd vcdplus.vpd &`,其中`vcdplus.vpd`是仿真过程中生成的波形文件。
5. DVE图形界面打开后,可以在左侧的Signals窗口中选择需要查看的信号,并将其添加到Waves窗口中,最后点击`Run`按钮即可开始波形分析。
注意:在执行`dve -vpd vcdplus.vpd &`命令时,需要确保DVE可执行文件的路径已经添加到系统环境变量中,否则需要在命令前加上DVE可执行文件的绝对路径。
相关问题
module crc8( data_in, clk, rst_n, crc7, crc6, crc5, crc4, crc3, crc2, crc1, crc0 ); input wire data_in; input wire clk; input wire rst_n; output wire crc7; output wire crc6; output wire crc5; output wire crc4; output wire crc3; output wire crc2; output wire crc1; output wire crc0; wire SYNTHESIZED_WIRE_5; reg DFF_inst8; reg DFF_inst; wire SYNTHESIZED_WIRE_2; wire SYNTHESIZED_WIRE_3; reg DFF_inst3; reg DFF_inst4; reg DFF_inst5; reg DFF_inst6; reg DFF_inst7; reg DFF_inst2; assign crc7 = DFF_inst8; assign crc6 = DFF_inst7; assign crc5 = DFF_inst6; assign crc4 = DFF_inst5; assign crc3 = DFF_inst4; assign crc2 = DFF_inst3; assign crc1 = DFF_inst2; assign crc0 = DFF_inst; always@(posedge clk or negedge rst_n) begin if (!rst_n) begin DFF_inst <= 1; end else begin DFF_inst <= SYNTHESIZED_WIRE_5; end end assign SYNTHESIZED_WIRE_5 = data_in ^ DFF_inst8; assign SYNTHESIZED_WIRE_2 = SYNTHESIZED_WIRE_5 ^ DFF_inst; always@(posedge clk or negedge rst_n) begin if (!rst_n) begin DFF_inst2 <= 1; end else begin DFF_inst2 <= SYNTHESIZED_WIRE_2; end end always@(posedge clk or negedge rst_n) begin if (!rst_n) begin DFF_inst3 <= 1; end else begin DFF_inst3 <= SYNTHESIZED_WIRE_3; end end always@(posedge clk or negedge rst_n) begin if (!rst_n) begin DFF_inst4 <= 1; end else begin DFF_inst4 <= DFF_inst3; end end always@(posedge clk or negedge rst_n) begin if (!rst_n) begin DFF_inst5 <= 1; end else begin DFF_inst5 <= DFF_inst4; end end always@(posedge clk or negedge rst_n) begin if (!rst_n) begin DFF_inst6 <= 1; end else begin DFF_inst6 <= DFF_inst5; end end always@(posedge clk or negedge rst_n) begin if (!rst_n) begin DFF_inst7 <= 1; end else begin DFF_inst7 <= DFF_inst6; end end always@(posedge clk or negedge rst_n) begin if (!rst_n) begin DFF_inst8 <= 1; end else begin DFF_inst8 <= DFF_inst7; end end assign SYNTHESIZED_WIRE_3 = SYNTHESIZED_WIRE_5 ^ DFF_inst2; endmodule 把这个代码修改成CRC-12编码器
好的,这里是修改后的CRC-12编码器代码,其中使用的CRC多项式为x^12 + x^11 + x^3 + x^2 + x + 1:
```
module crc12(
data_in,
clk,
rst_n,
crc11,
crc10,
crc9,
crc8,
crc7,
crc6,
crc5,
crc4,
crc3,
crc2,
crc1,
crc0
);
input wire data_in;
input wire clk;
input wire rst_n;
output wire crc11;
output wire crc10;
output wire crc9;
output wire crc8;
output wire crc7;
output wire crc6;
output wire crc5;
output wire crc4;
output wire crc3;
output wire crc2;
output wire crc1;
output wire crc0;
wire [11:0] crc;
wire [11:0] crc_next;
wire [11:0] data;
assign data = {data_in, 6'b0};
always@(posedge clk or negedge rst_n) begin
if (!rst_n) begin
crc <= 12'hFFF;
end
else begin
crc <= crc_next;
end
end
assign crc11 = crc[11];
assign crc10 = crc[10];
assign crc9 = crc[9];
assign crc8 = crc[8];
assign crc7 = crc[7];
assign crc6 = crc[6];
assign crc5 = crc[5];
assign crc4 = crc[4];
assign crc3 = crc[3];
assign crc2 = crc[2];
assign crc1 = crc[1];
assign crc0 = crc[0];
assign crc_next[11:0] = {crc[10:0], 1'b0} ^ (data << 4) ^ (data << 1) ^ data;
endmodule
```
这个代码使用了一个12位的寄存器crc来保存当前的CRC校验值,每次输入一个数据位时,根据CRC多项式进行异或运算得到下一个CRC值,并将其保存到crc_next中。在时钟上升沿时,将crc_next的值赋给crc寄存器,完成一次CRC计算。最后,根据CRC校验位的位置将crc寄存器的值输出到crc11到crc0中,即可得到CRC-12校验码。
case KEY_CODE_UP: next_index = index > SET_ID_VOLUME ? (index - 1) : (SET_ID_VOICE_ASSISTANT_SWITCH); next_list = lv_obj_get_child(p_setting_win, next_index); next_bg = lv_obj_get_child(next_list,0); ws01_setting_list_group[next_index].selected = true; ws01_setting_list_group[index].selected = false; lv_obj_remove_style(list, &style_btn_focus, 0); lv_obj_set_style_bg_color(bg, lv_color_hex(0x2e3033), 0); lv_obj_add_style(next_list, &style_btn_focus, 0); lv_obj_set_style_bg_color(next_bg, lv_color_hex(0x558dff), 0); lv_obj_scroll_to_view(next_list, LV_ANIM_OFF); break; case KEY_CODE_DOWN: next_index = index < SET_ID_VOICE_ASSISTANT_SWITCH ? (index + 1) : (SET_ID_VOLUME); next_list = lv_obj_get_child(p_setting_win, next_index); next_bg = lv_obj_get_child(next_list,0); ws01_setting_list_group[next_index].selected = true; ws01_setting_list_group[index].selected = false; lv_obj_remove_style(list, &style_btn_focus, 0); lv_obj_set_style_bg_color(bg, lv_color_hex(0x2e3033), 0); lv_obj_add_style(next_list, &style_btn_focus, 0); lv_obj_set_style_bg_color(next_bg, lv_color_hex(0x558dff), 0); lv_obj_scroll_to_view(next_list, LV_ANIM_OFF); break;
这段代码是用来处理按键操作的。KEY_CODE_UP 表示上移按键,KEY_CODE_DOWN 表示下移按键。当按下上移按键时,会选择上一个选项,当按下下移按键时,会选择下一个选项。同时,还会修改选项的背景颜色,以表示当前选中的选项。其中,lv_obj_get_child 函数用来获取指定对象的指定子对象,lv_obj_remove_style 函数用来移除指定对象的指定样式,lv_obj_add_style 函数用来添加指定对象的指定样式,lv_obj_set_style_bg_color 函数用来设置指定对象的背景颜色,lv_obj_scroll_to_view 函数用来滚动对象到可见区域。
阅读全文