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

推荐订阅源

C
Cisco Blogs
爱范儿
爱范儿
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
Jina AI
Jina AI
Project Zero
Project Zero
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学
Simon Willison's Weblog
Simon Willison's Weblog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tenable Blog
F
Fortinet All Blogs
大猫的无限游戏
大猫的无限游戏
Last Week in AI
Last Week in AI
月光博客
月光博客
雷峰网
雷峰网
G
Google Developers Blog
V
V2EX
T
Tor Project blog
罗磊的独立博客
Schneier on Security
Schneier on Security
Know Your Adversary
Know Your Adversary
W
WeLiveSecurity
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Privacy International News Feed
S
Securelist
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
小众软件
小众软件
Scott Helme
Scott Helme
I
Intezer
T
Threat Research - Cisco Blogs
The GitHub Blog
The GitHub Blog
N
Netflix TechBlog - Medium
C
CERT Recently Published Vulnerability Notes
Security Archives - TechRepublic
Security Archives - TechRepublic
酷 壳 – CoolShell
酷 壳 – CoolShell
L
LINUX DO - 最新话题
N
News | PayPal Newsroom
L
Lohrmann on Cybersecurity
T
Troy Hunt's Blog
Google DeepMind News
Google DeepMind News
P
Proofpoint News Feed
人人都是产品经理
人人都是产品经理
Latest news
Latest news
AWS News Blog
AWS News Blog
Apple Machine Learning Research
Apple Machine Learning Research

博客园 - 所长

频谱仪 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 差分 逻辑分析仪 抓包 vivado axi PS-PL 封装IP 创造自定义 外设 libero Simulate - ModelSim ME (三) 实战测试 双端口 RAM 读写 libero Simulate - ModelSim ME (二) 语法分析 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-24 · via 博客园 - 所长
//////////////////////////////////////////////////////////////////////
// Created by Microsemi SmartDesign Fri Apr 24 14:20:16 2026
// Testbench Template
// This is a basic testbench that instantiates your design with basic 
// clock and reset pins connected.  If your design has special
// clock/reset or testbench driver requirements then you should 
// copy this file and modify it. 
//////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////
// Company: <Name>
//
// File: uart_rx_testbench.v
// File history:
//      <Revision number>: <Date>: <Comments>
//      <Revision number>: <Date>: <Comments>
//      <Revision number>: <Date>: <Comments>
//
// Description: 
//
// <Description here>
//
// Targeted device: <Family::ProASIC3> <Die::A3P250> <Package::100 VQFP>
// Author: <Name>
//
/////////////////////////////////////////////////////////////////////////////////////////////////// 

`timescale 1ns/100ps

module uart_rx_testbench;

parameter SYSCLK_PERIOD = 25;// 40MHZ

reg SYSCLK;
reg NSYSRESET;

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

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


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


// sysclk 计数 方便观察时序
reg [31:0] clk_cnt;
always @(posedge SYSCLK or negedge NSYSRESET) begin
    if( !NSYSRESET ) begin
        clk_cnt <= 32'b0;
    end else begin
        clk_cnt <= clk_cnt + 32'b1;
    end
end

// 常用宏定义
// i_ input 信号
// o_ output 信号
// r_ reg  信号
// w_ wire 信号
// t_ trigger 信号
parameter TRUE  = 1'b1;
parameter FALSE = 1'b0;

// 测试串口接收处理模块

wire w_rx_oen;
reg [7:0] r_rx_data;
reg r_rx_ready;

uart_rx uart_rx_0
(
    .clk_40mhz(SYSCLK), // 时钟和复位信号 都是输入信号,因此不加 i_
    .rst_n(NSYSRESET),

    // UART RX
    // 低电平将 DATA_OUT 读入, 将  RXRDY 和 所有错误复位 ,溢出和校验错误 复位
    .o_rx_oen(w_rx_oen),
     // 输出数据总线 位宽 [7:0]
    .i_rx_data(r_rx_data),
    // 0= RX FIFO 空, 1= 可读取
    .i_rx_ready(r_rx_ready)

);


// 编写串口数据
reg [7:0] tx_cnt;
always @(posedge SYSCLK or negedge NSYSRESET) begin
    if( !NSYSRESET ) begin
        r_rx_data <= 8'd0;
        r_rx_ready <= FALSE;
        tx_cnt <= 8'd0;
    end else begin
        tx_cnt <= tx_cnt + 8'd1;

        case(tx_cnt)
            0: begin
                r_rx_data <= 8'hEC;
                r_rx_ready <= TRUE;
            end
            1: begin
                r_rx_ready <= FALSE;
            end
            2: begin
                r_rx_data <= 8'h91;
                r_rx_ready <= TRUE;
            end
            3: begin
                r_rx_ready <= FALSE;
            end
            4: begin
                r_rx_data <= 8'h00;
                r_rx_ready <= TRUE;
            end
            5: begin
                r_rx_ready <= FALSE;
            end
            6: begin
                r_rx_data <= 8'h07;
                r_rx_ready <= TRUE;
            end
            7: begin
                r_rx_ready <= FALSE;
            end
            8: begin
                r_rx_data <= 8'h01;
                r_rx_ready <= TRUE;
            end
            9: begin
                r_rx_ready <= FALSE;
            end
            10: begin
                r_rx_data <= 8'hF2;
                r_rx_ready <= TRUE;
            end
            11: begin
                r_rx_ready <= FALSE;
            end
            12: begin
                r_rx_data <= 8'h23;
                r_rx_ready <= TRUE;
            end
            13: begin
                r_rx_ready <= FALSE;
            end
            default: begin
                r_rx_ready <= FALSE;
            end
        endcase

    end
end

endmodule

image

posted on 2026-04-24 17:24  所长  阅读(0)  评论()    收藏  举报