省流:不同的公司风格不同,都会使用。
数字电路设计主要就是,选择器、全加器、比较器,乘法器,几个常用逻辑门,再加个D触发器,电路基本都能实现了。
切换到具体语法System Verilog本来就是Verilog的语法扩展,所以Verilog支持的SV都支持。
组合逻辑用assign是同样的,用always_comb代替always @*。
时序逻辑用always_ff @(posedge clk or negedge rst_n)代替always @(posedge clk or negedge rst_n)
信号声明logic代替wire/reg。不用再繁琐的区分数据类型。
端口声明可以用多维数组。一些处理用generate for不要太爽。
以上这几条改变不大,可以无缝适应。
接口Interface
SystemVerilog提供了一个新的、高层抽象的模块连接,这个连接被称为接口(Interface)。它可以将常用的比较规范的端口定义出来,方便集成连接。
举个例子,首先定义一组interface,文件为interface.vh
interface chip_bus (input logic clock, resetn); logic interrupt_req, grant, ready; logic [31:0] address; wire [63:0] data; modport master (input interrupt_req, input address, output grant, ready, inout data, input clock, resetn); modport slave (output interrupt_req, output address, input grant, ready, inout data, input clock, resetn); endinterface然后在子模块中就可以include使用这一组定义。
`include "interface.vh" module primary( chip_bus.mater local_bus, chip_bus.slave primary_local_bus, input clock, input resetn ); endmodule `include "interface.vh" module secondary( chip_bus.slave local_bus, chip_bus.master secondary_local_bus, `ifdef FPGA input fpga_clk, `endif input clock, input resetn ); endmodule
最后在top中例化两个子模块,top上也可以定义interface,直接连接到子模块,两个子模块之间的interface连接在顶层定义一个用于连线的interface。
`include "interface.vh"
module top (
chip_bus.master secondary_local_bus,
chip_bus.slave primary_local_bus,
`ifdef FPGA
input fpga_clk,
`endif
input clock,
input resetn
);
chip_bus local_bus();
primary u_primary(/*autoinst*/
.local_bus (local_bus.master ), //interface//ahb_bus.mater
.primary_local_bus (primary_local_bus ), //interface//axi_bus.slave
.clock (clock ), //input
.resetn (resetn ) //input
);
secondary u_secondary(/*autoinst*/
.local_bus (local_bus.slave ), //interface//ahb_bus.slave
.secondary_local_bus (secondary_local_bus ), //interface//axi_bus.master
`ifdef FPGA
.fpga_clk (fpga_clk ), //input
`endif
.clock (clock ), //input
.resetn (resetn ) //input
);
endmodule
使用interface可以提高集成的效率,不容易出错,方便检视。 当然要是问我推荐用SV还是Verilog,我建议是遵守公司代码规范,公司让用啥就用啥。
审核编辑:刘清
-
比较器
+关注
关注
14文章
1887浏览量
111486 -
Verilog
+关注
关注
30文章
1370浏览量
114191 -
D触发器
+关注
关注
3文章
181浏览量
49547 -
数字电路
+关注
关注
193文章
1648浏览量
83085
原文标题:现在公司里做设计用SV还是Verilog?
文章出处:【微信号:IP与SoC设计,微信公众号:IP与SoC设计】欢迎添加关注!文章转载请注明出处。
发布评论请先 登录
FPGA编程是用VHDL还是verilog HDL好用?谢谢了!
我是学Verilog呢还是VHDL?
做硬件研发工作还是转行去写verilog代码的工作
请问在Verilog里可以直接用'/'来做除法吗?如果不能要怎样做除法呀??
ISSI公司的sram verilog model使用
Quartus II 现在用verilog还是block dragram/schematic file
使用SpinalHDL状态机生成的Verilog代码如何导入到quartus工程中去呢
如何使用Verilog-HDL做CPLD设计的时序逻辑电路的实现

现在公司里做设计是用SV还是Verilog?
评论