fpga助教面试题

第一题

c 复制代码
module sfp_pwm(
input wire clk, //clk is 200M
input wire rst_n,
input wire clk_10M_i,
input wire PPS_i,
output reg pwm
)
reg [6:0] cunt  ;

always @(posedge clk ) begin
    if(!rst_n)
    cunt<=0;
    else if(cunt==19)   //200M是10M的20倍
    cunt<=0;
    else
    cunt<=cunt+1;
    
end
always @(posedge clk_10M_i ) begin
    if(!rst_n)
    pwm<=0;
    else if(PPS_i&&cunt<15)
    pwm<=1;
    else if(PPS_i==0&&cunt<10)
    pwm<=1;
    else
    pwm<=0;
    end
endmodule

第二题 需要用到vivado pll时钟这个ip核

因为1.023这个时钟无法直接产生可以先产生10.23M的时钟 再通过分频产生1.023 M的时钟

c 复制代码
`timescale 1ns / 1ps
module test_two(
    input  wire        clk, //clk is 60M 
    input  wire        rst_n, 
    output wire        clk_1023k_o, 
    output wire        ca
    );
wire clk_out1;
wire resetn  ;
wire locked  ;
reg  [3:0]  cunt    ;
wire        clk_1023;
reg  [11:0] ca_r    ;

assign resetn=(rst_n&&locked)?1:0;
assign clk_1023k_o=(cunt<5)?1:0; //1.023M时钟
assign ca=ca_r[0];
always @(posedge clk_out1 ) begin
    if(!resetn)
    cunt<=0;
    else if(cunt==9)
    cunt<=0;
    else
    cunt<=cunt+1;    
end
always @(posedge clk_1023k_o ) begin
    if(!resetn)
    ca_r<=12'h124;
    else
    ca_r <= {ca_r[10:0], ca_r[11] ^ ca_r[10] ^ ca_r[7] ^ ca_r[5]};
end

  clk_wiz_0 instance_name
   (
    // Clock out ports
    .clk_out1(clk_out1),     // output clk_out1
    // Status and control signals
    .resetn(resetn), // input resetn
    .locked(locked),       // output locked
   // Clock in ports
    .clk_in1(clk));      // input clk_in1

endmodule
相关推荐
luoganttcc11 小时前
Taalas 将人工智能模型蚀刻到晶体管上,以提升推理能力
人工智能·fpga开发
国科安芯12 小时前
医疗成像设备系统电源芯片国产替代可行性研究
网络·单片机·嵌入式硬件·fpga开发·硬件架构
不是AI12 小时前
【电路仿真】【Logisim】二、7408 TTL
单片机·fpga开发
江蘇的蘇13 小时前
基于FPGA开发应用SATA硬盘
fpga开发
LCMICRO-1331084774619 小时前
长芯微LDM63085完全P2P替代ADM2483,是一款基于数字隔离技术的高可靠性的半双工隔离RS-485收发器
单片机·嵌入式硬件·fpga开发·硬件工程·dsp开发
博览鸿蒙21 小时前
芯片设计过程中常见的挑战有哪些?
fpga开发
LCMICRO-1331084774621 小时前
长芯微LSC3490完全P2P替代MAX3490,3.3V 高静电防护 10M 全双工 RS485/RS422 收发器
单片机·嵌入式硬件·fpga开发·硬件工程·dsp开发
二十画~书生1 天前
攻克BGA扇出+高速信号难题—逻辑派FPGA-G1开发板6层PCB全流程设计总结
嵌入式硬件·fpga开发·硬件工程·pcb工艺
Yyq130208696821 天前
实时时钟和日历电路-MS85163-替PCF8563等
单片机·嵌入式硬件·fpga开发
悲喜自渡7211 天前
FPGA学习(自用)
fpga开发