随笔 - 284, 文章 - 0, 评论 - 60, 阅读 - 53万
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

简化版的复数相关运算---Verilog

Posted on   沉默改良者  阅读(1136)  评论(0编辑  收藏  举报

简化版的复数相关运算---Verilog

复制代码
//**************************************************************************************************************
//Function description: Simplify the complex multiplication operation to the addition operation

//Input: clock,reset,counter,multiplier_Real,multiplier_Imag,known_Real,known_Imag
//Output: output_Real,output_Imag

/*参考《中山大学论文》,得将已知STS取共轭之后再与量化结果相乘*****//////
//Example:conjugate{(a + i*b)}= (a - i*b)
//       conj{(a+i*b)}*(1+i) = (a+b)+i*(a-b)
//       conj{(a+i*b)}*(1-i) = (a-b)+i*(-a-b) 
//       conj{(a+i*b)}*(-1+i)= (-a+b)+i*(a+b)
//       conj{(a+i*b)}*(-1-i)= (-a-b)+i*(-a+b)
//**************************************************************************************************************
`timescale 1ns/10ps

module Simple_Correlation(

    input            wire                  Clk,                            /*系统时钟*****//////
    input            wire                  Rst_n,                        /*系统复位信号******//////
    input            wire                  inEn,
    input            wire                  multiplier_Real,             /*移位寄存器实部******//////
    input            wire                  multiplier_Imag,             /*移位寄存器虚部******//////
    input            wire     [15:0]       known_Real,                 /*本地已知短训练序列实部,二进制补码表示*******///////
    input            wire     [15:0]       known_Imag,                 /*短训练序列虚部*******///////

    output           reg      [16:0]       output_Real,         /*输出实部,扩展为17位输出,输出为二进制补码表示*******///////
    output           reg      [16:0]       output_Imag,         /*输出虚部*******///////
    output           reg                   OutputEnable);

//-----------------------------------------------------------------------------------

/*输入的multiplier等于0表示正数,等于1表示负数*****//////

always @ (posedge Clk or negedge Rst_n)    
begin
    if (!Rst_n)
    begin
        output_Real <= 0;
        output_Imag <= 0;
        OutputEnable <= 0;
    end
    else if (inEn)
    begin
        OutputEnable <= 1;                                                        
        if (multiplier_Real == 0 && multiplier_Imag == 0)             
        begin
            output_Real <= {{1{known_Real[15]}},known_Real} + {{1{known_Imag[15]}},known_Imag};
            output_Imag <= {{1{known_Real[15]}},known_Real} - {{1{known_Imag[15]}},known_Imag};
        end
        else if (multiplier_Real == 0 && multiplier_Imag == 1)
        begin
            output_Real <= {{1{known_Real[15]}},known_Real} - {{1{known_Imag[15]}},known_Imag};
            output_Imag <= - {{1{known_Real[15]}},known_Real} - {{1{known_Imag[15]}},known_Imag};
        end
        else if (multiplier_Real == 1 && multiplier_Imag == 0)
        begin
            output_Real <= - {{1{known_Real[15]}},known_Real} + {{1{known_Imag[15]}},known_Imag};
            output_Imag <= {{1{known_Real[15]}},known_Real} + {{1{known_Imag[15]}},known_Imag};
        end
        else  //(buffer_multiplier_Real==1 && buffer_multiplier_Imag==1)
        begin
            output_Real <= - {{1{known_Real[15]}},known_Real} - {{1{known_Imag[15]}},known_Imag};
            output_Imag <= - {{1{known_Real[15]}},known_Real} + {{1{known_Imag[15]}},known_Imag};
        end
    end
    else         
    begin
        output_Real <= 0;
        output_Imag <= 0;
        OutputEnable <= 0;
    end            
end

endmodule
复制代码

 

编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
历史上的今天:
2018-06-29 阅读 Device Driver Programmer Guide 笔记
2017-06-29 Xilinx AXI总线学习(1)
点击右上角即可分享
微信分享提示