惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
NISL@THU
NISL@THU
S
Securelist
O
OpenAI News
S
Security Affairs
Cyberwarzone
Cyberwarzone
T
Threatpost
Simon Willison's Weblog
Simon Willison's Weblog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 最新话题
C
Cisco Blogs
PCI Perspectives
PCI Perspectives
SecWiki News
SecWiki News
S
Secure Thoughts
GbyAI
GbyAI
I
Intezer
AWS News Blog
AWS News Blog
F
Fortinet All Blogs
I
InfoQ
阮一峰的网络日志
阮一峰的网络日志
Google Online Security Blog
Google Online Security Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
A
About on SuperTechFans
S
Schneier on Security
P
Proofpoint News Feed
雷峰网
雷峰网
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
小众软件
小众软件
H
Heimdal Security Blog
Microsoft Security Blog
Microsoft Security Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
V
V2EX
L
Lohrmann on Cybersecurity
Security Latest
Security Latest
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
H
Hacker News: Front Page
Cisco Talos Blog
Cisco Talos Blog
Webroot Blog
Webroot Blog
T
Tenable Blog
MyScale Blog
MyScale Blog
博客园 - 司徒正美
S
SegmentFault 最新的问题
Y
Y Combinator Blog
腾讯CDC
Hacker News: Ask HN
Hacker News: Ask HN
M
MIT News - Artificial intelligence
G
GRAHAM CLULEY

博客园 - 所长

Software-Defined Radio for Engineers 一 频谱仪 N9020A 操作步骤记录 FPGA-CAN MAC 层 IP 核测试(二) 源码阅读 libero reg 编译时 占用 RAM 资源 而不是 LUT 资源 加扰和解扰 FPGA-CAN MAC 层 IP 核测试(一) 上板实测 Microchip SoftConsole v2022.2-RISC-V-747 polarfire soc 裸机例程中 链接文件 mpfs-envm-lma-scratchpad-vma.ld 分析 FlashPro5 导致 window11 蓝屏 libero verilog 模块例化时,信号不存在 默认是 不连接 A3P250 在线 debug 抓取信号 Identify 在线逻辑分析仪 MPFS250T MSS 引脚 上下拉配置 如何在 libero 中 写一个 axi4 slave 总线的 IP核 可以 和 CoreAXI4Interconnect 连接 (五) 官方参考 verilog 按键消抖模块 如何在 libero 中 写一个 axi4 slave 总线的 IP核 可以 和 CoreAXI4Interconnect 连接 (四) axi-lite 信号抓取 libero Active Probes 如何在 libero 中 写一个 axi4 slave 总线的 IP核 可以 和 CoreAXI4Interconnect 连接 (三) C代码测试 访问卡死 如何在 libero 中 写一个 axi4 slave 总线的 IP核 可以 和 CoreAXI4Interconnect 连接 (二) axi-lite 如何在 libero 中 写一个 axi4 slave 总线的 IP核 可以 和 CoreAXI4Interconnect 连接(一)libero 设置把模块信号变总线方式 libero 2025.2 Macro Library User Guide for SmartFusion 2 and IGLOO 2 FPGAs 如何在 libero 中 写一个 axi4 slave 总线的 IP核 可以 和 CoreAXI4Interconnect 连接 (零) MSS CFG MPFS250T FLASH 只有 128KB 调整代码优化 AD9361 SPI no-os 文件移植 SoftConsole MPFS250T 初学(七) 初始化日志记录 AD9361 SPI no-os 文件移植 SoftConsole MPFS250T 初学(六) 开启 日志打印 Calibration TIMEOUT (0x247, 0x2) AD9361 SPI no-os 文件移植 SoftConsole MPFS250T 初学(五) ad9361_check_cal_done 卡死 AD9361 SPI no-os 文件移植 SoftConsole MPFS250T 初学(四) ad9361_init 编译报错 和 读取 AD9361 ID AD9361 SPI no-os 文件移植 SoftConsole MPFS250T 初学(三) 接口适配到自己的板子 AD9361 SPI no-os 文件移植 SoftConsole MPFS250T 初学(二) AD9361 初始化流程 熟悉 AD9361 SPI no-os 文件移植 SoftConsole MPFS250T 初学(一) 驱动代码移植 RS422 差分 逻辑分析仪 抓包 libero Simulate - ModelSim ME 仿真 串口数据处理模块 vivado axi PS-PL 封装IP 创造自定义 外设 libero Simulate - ModelSim ME (三) 实战测试 双端口 RAM 读写 libero Simulate - ModelSim ME (一) 新建工程 libero smartdebug Libero SoC CMP402 PolarFire SOC MSS 时钟源选择 polarfire Temperature and Voltage Sensor 温度和电压传感器 log2 PolarFire SoC Clock Conditioning Circuitry - CCC (PLL/DLL) 时钟源介绍(二) PolarFire SoC Clock Conditioning Circuitry - CCC (PLL/DLL) 初始化(三) PolarFire SoC Clock Conditioning Circuitry - CCC (PLL/DLL) 简单介绍(一) libero export flashpro express Job Libero MPFS250T PFSoC MSS Configurator 2025.2 DDR3 ECC 配置 Libero MPFS250T 如何使用 FPExpress 2025.2 烧录 MPFS250TS Direct C 编程后,使用 JTAG 读取的 DEVICE_INFO LOG Xilinx SDK 2019.1 使用 JTAG 将 10MB 文件 复制到 ZYNQ 的 DDR中 大约 20 秒 libero PolarFire soc SPI-DirectC 实战 dp_G5M_check_cycle_count libero PolarFire soc SPI-DirectC 实战 dp_G5M_do_program libero PolarFire soc SPI-DirectC 实战 dp_G5M_erase_action libero PolarFire soc SPI-DirectC 实战 dp_G5M_verify_digest_action
libero Simulate - ModelSim ME (二) 语法分析
所长 · 2026-04-14 · via 博客园 - 所长

libero Simulate - ModelSim ME (一) 新建工程 - 所长 - 博客园

libero Simulate - ModelSim ME (二) 语法分析 - 所长 - 博客园

libero Simulate - ModelSim ME (三) 实战测试 双端口 RAM 读写

代码 

/////////////////////////////////////////////////////////////////////////////////////////////////// 

`timescale 1ns/100ps

module test_dpsram;

parameter SYSCLK_PERIOD = 100;// 10MHZ

reg SYSCLK;
reg NSYSRESET;

initial
begin
    SYSCLK = 1'b0;
    NSYSRESET = 1'b0;
end

//////////////////////////////////////////////////////////////////////
// Reset Pulse
//////////////////////////////////////////////////////////////////////
initial
begin
    #(SYSCLK_PERIOD * 10 )
        NSYSRESET = 1'b1;
end


//////////////////////////////////////////////////////////////////////
// Clock Driver
//////////////////////////////////////////////////////////////////////
always @(SYSCLK)
    #(SYSCLK_PERIOD / 2.0) SYSCLK <= !SYSCLK;


endmodule

image

语法一:初始化

  初始化语句: 让变量 为 0;

initial
begin
    SYSCLK = 1'b0;
    NSYSRESET = 1'b0;
end

语法二:生成时钟信号

成一个连续不断、永远翻转的时钟信号。

always @(SYSCLK)
    #(SYSCLK_PERIOD / 2.0) SYSCLK <= !SYSCLK;
`timescale 1ns/100ps 定义了 仿真时间单位 1ns; 时间精度 100ps
parameter SYSCLK_PERIOD = 100;// 100ns 是一个 时钟周期, 则 产生的时钟信号是 10Mhz;

等价下面这个语句 , #50 表示 50个时间单位即 50ns 后 SYSCLK 反转一次
always #50 SYSCLK = ~SYSCLK;

语法三:延时

#50 表示 延迟50个时钟周期单位;

语法四:产生复位信号

//////////////////////////////////////////////////////////////////////

// Reset Pulse 

//////////////////////////////////////////////////////////////////////

initial

begin

    #(SYSCLK_PERIOD * 10 )   // SYSCLK_PERIOD  是一个 10Mhz 的 时钟,  1us 后 复位信号 拉高

        NSYSRESET = 1'b1;

end

语法五:TASK

6.2 Verilog 任务 | 菜鸟教程

initial begin

    // call the main task

    main;

end

// Main task

task main;

begin

    $display("Hello, Testbench, task main!");

end

endtask

语法六:打印变量

// 变量

reg [31:0] tick_cnt;

always @(posedge SYSCLK or negedge NSYSRESET) begin

    if( !NSYSRESET ) begin

        tick_cnt <= 32'b0;

    end else begin

        if( tick_cnt == 32'd10 ) begin

            tick_cnt <= 32'b0;

            $display("tick_cnt = %d", tick_cnt);

        end else begin

            tick_cnt <= tick_cnt + 1;

        end

    end

end

///////////////////////////////////////////////////////////////////////////////////////////////////
// Company: <Name>
//
// File: test_dpsram.v
// File history:
//      <Revision number>: <Date>: <Comments>
//      <Revision number>: <Date>: <Comments>
//      <Revision number>: <Date>: <Comments>
//
// Description: 
//
// <Description here>
//
// Targeted device: <Family::PolarFireSoC> <Die::MPFS250T> <Package::FCVG484>
// Author: <Name>
//
/////////////////////////////////////////////////////////////////////////////////////////////////// 

`timescale 1ns/100ps

module test_dpsram;

parameter SYSCLK_PERIOD = 100;// 10MHZ

reg SYSCLK;
reg NSYSRESET;

initial
begin
    SYSCLK = 1'b0;
    NSYSRESET = 1'b0;
end

//////////////////////////////////////////////////////////////////////
// Reset Pulse
//////////////////////////////////////////////////////////////////////
initial
begin
    #(SYSCLK_PERIOD * 10 )
        NSYSRESET = 1'b1;
end


//////////////////////////////////////////////////////////////////////
// Clock Driver
//////////////////////////////////////////////////////////////////////
always @(SYSCLK) begin
    #(SYSCLK_PERIOD / 2.0) SYSCLK <= !SYSCLK;
end


initial begin
    // call the main task
    main;
end

// Main task
task main;
begin
    $display("Hello, Testbench, task main!");
end
endtask

// 变量
reg [31:0] tick_cnt;

always @(posedge SYSCLK or negedge NSYSRESET) begin
    if( !NSYSRESET ) begin
        tick_cnt <= 32'b0;
    end else begin
        if( tick_cnt == 32'd10 ) begin
            tick_cnt <= 32'b0;
            $display("tick_cnt = %d", SYSCLK);
        end else begin
            tick_cnt <= tick_cnt + 1;
        end
    end
end

endmodule