当前位置: 首页 > news >正文

ARINC818_FILE

module ARINC818_FILE(
    input clk,
    input rst_n,
    input [31:0] container_cnt,    // 容器计数
    input [15:0] advb_frame_cnt,   // advb帧计数
    input advb_frame_last,          // ADVB最后一帧
    input [15:0] img_width,         // 图像宽度
    input [15:0] img_high,          // 图像高度

    output reg [31:0] sofi,        // 首帧起始定界符
    output reg [31:0] sofn,        // 非首帧起始定界符
    output reg [31:0] eofn,        // 非最后帧结束定界符
    output reg [31:0] eoft,        // 最后帧结束定界符
    output reg [31:0] advb_idle,   // advb帧间隙字符

    output reg [31:0] frame_words0_r_ctl,
    output reg [31:0] frame_words0_dst_id,
    output reg [31:0] frame_words1_cs_ctl,
    output reg [31:0] frame_words1_src_id,
    output reg [31:0] frame_words2_type,
    output reg [31:0] frame_words2_f_ctl,
    output reg [31:0] frame_words3_seq_id,
    output reg [31:0] frame_words3_df_ctl,
    output reg [31:0] frame_words3_seq_cnt,
    output reg [31:0] frame_words4_OX_RX_ID,
    output reg [31:0] frame_words5_parameter,
    output reg [31:0] container_words0_cnt,
    output reg [31:0] container_words1_id,
    output reg [31:0] container_words2_time,
    output reg [31:0] container_words3_time,
    output reg [31:0] container_words4_fps,
    output reg [31:0] container_words4_rate
);

    // K28.5, D21.5, D22.2编码示例(ARINC 818协议定义的字符编码)
    localparam [7:0] K28_5 = 8'hBC; // 示例码,真实协议确认
    localparam [7:0] D21_5 = 8'h95;
    localparam [7:0] D22_2 = 8'hB5;
    localparam [31:0] SOFI_VAL = {K28_5, D21_5, D22_2, D22_2};
    localparam [31:0] SOFN_VAL = {K28_5, D21_5, D21_5, D22_2};
    localparam [31:0] EOFN_VAL = {K28_5, D22_2, D21_5, D21_5};
    localparam [31:0] EOFT_VAL = {K28_5, D22_2, D22_2, D21_5};
    localparam [31:0] ADVB_IDLE_VAL = 32'hBC95_B5B5;  // 休止符

    // 初始化和状态更新
    always @(posedge clk or negedge rst_n) begin
        if (!rst_n) begin
            sofi <= SOFI_VAL;
            sofn <= SOFN_VAL;
            eofn <= EOFN_VAL;
            eoft <= EOFT_VAL;
            advb_idle <= ADVB_IDLE_VAL;

            // 这里frame_words*和container_words*初始化为0或默认值
            frame_words0_r_ctl <= 32'd0;
            frame_words0_dst_id <= 32'd0;
            frame_words1_cs_ctl <= 32'd0;
            frame_words1_src_id <= 32'd0;
            frame_words2_type <= 32'd0;
            frame_words2_f_ctl <= 32'd0;
            frame_words3_seq_id <= 32'd0;
            frame_words3_df_ctl <= 32'd0;
            frame_words3_seq_cnt <= 32'd0;
            frame_words4_OX_RX_ID <= 32'd0;
            frame_words5_parameter <= 32'd0;
            container_words0_cnt <= 32'd0;
            container_words1_id <= 32'd0;
            container_words2_time <= 32'd0;
            container_words3_time <= 32'd0;
            container_words4_fps <= 32'd0;
            container_words4_rate <= 32'd0;
        end else begin
            // 根据advb_frame_last控制使用SOFI或SOFN
            sofi <= advb_frame_last ? SOFI_VAL : sofi;
            sofn <= (!advb_frame_last) ? SOFN_VAL : sofn;
            eofn <= (!advb_frame_last) ? EOFN_VAL : eofn;
            eoft <= advb_frame_last ? EOFT_VAL : eoft;

            // 赋值frame_words,示例根据计数器简单赋值,可根据协议详细填写
            frame_words0_r_ctl <= {16'd0, advb_frame_cnt};      // 示例:下16位为帧计数
            frame_words0_dst_id <= 32'h0000_0001;              // 目的ID示例
            frame_words1_cs_ctl <= 32'h0000_0000;               // 控制字段示例
            frame_words1_src_id <= 32'h0000_0002;               // 源ID示例
            frame_words2_type <= 32'h0000_0001;                 // 帧类型示例
            frame_words2_f_ctl <= 32'h0000_0000;                // 帧控制示例
            frame_words3_seq_id <= 32'h0000_0000;                // 序列ID示例
            frame_words3_df_ctl <= 32'h0000_0000;                // DF控制示例
            frame_words3_seq_cnt <= {16'd0, advb_frame_cnt};    // 序列计数示例
            frame_words4_OX_RX_ID <= 32'h0000_0000;             // OX/RX示例
            frame_words5_parameter <= {img_width, img_high};     // 图片分辨率打包示例

            // 容器相关信息直接赋值
            container_words0_cnt <= container_cnt;
            container_words1_id <= 32'h0000_0001;              // 容器ID示例
            container_words2_time <= 32'd0;                      // 时间戳示例
            container_words3_time <= 32'd0;                      // 时间戳示例
            container_words4_fps <= 32'd60;                      // 帧率示例
            container_words4_rate <= 32'd1000;                   // 码率示例
        end
    end

endmodule
 

相关文章:

  • Nginx 安全防护与 HTTPS 部署实战笔记
  • Oracle 的V$LOCK 视图详解
  • nginx安全防护与https部署实战
  • GaussDB资源冻结与解冻:精细化资源管理的实践与策略
  • 《软件工程》第 7 章 - 软件体系结构设计
  • Android开机向导定制(1)开机向导加载流程
  • 《软件工程》第 15 章 - 软件度量与估算:从概念到实践​
  • opencvsharp usb摄像头录像 c# H264编码
  • Python 网络编程入门
  • MMA: Multi-Modal Adapter for Vision-Language Models论文解读
  • macOS烧录stm32程序初步成功
  • 海思3519V200 上基于 Qt 的 OpenCV 和 MySql 配置开发
  • Simple Factory(简单工厂)
  • 《软件工程》第 14 章 - 持续集成
  • C++——STL——unordered_map与unordered_set的使用以及使用哈希表封装unordered_map/set
  • DIY 自己的 MCP 服务-核心概念、基本协议、一个例子(Python)
  • ChatGPT 如何工作——提示工程、对话记忆与上下文管理解析
  • 最新Spring Security实战教程(十六)微服务间安全通信 - JWT令牌传递与校验机制
  • 从“无我”到“无生法忍”:解构执着的终极智慧
  • Godot的RichTextLabel富文本标签,鼠标拖拽滚动,方向键滚动,底部吸附,自动滚动
  • 网站建设 服务质量保证/烟台百度推广公司
  • 个人网站的设计与实现结论/郑州seo排名哪有
  • 以3d全景做的网站/百度培训
  • 建网站免费咨询/如何建立网站平台
  • 网站编程培训学校招生/建网站多少钱
  • 济南专业网站建设咨询/搜索关键词排名优化