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
相关推荐
xgbing6 小时前
在ubuntu中安装modelsim
fpga开发·modelsim
碎碎思11 小时前
SURF:SLAC 开源 FPGA 与 ASIC 通用 RTL 框架详解
fpga开发
FPGA小迷弟13 小时前
FPGA在工业控制行业的应用,行业研究文章
fpga开发·制造·数据采集·fpga·工业控制
洋洋Young14 小时前
【Xilinx FPGA】CLB SliceL 与 SliceM
fpga开发·xilinx·clb
集芯微电科技有限公司14 小时前
PC1001超高频率(50HMZ)单通单低侧GaN FET驱动器支持正负相位配置
数据结构·人工智能·单片机·嵌入式硬件·神经网络·生成对抗网络·fpga开发
stars-he16 小时前
FPGA学习笔记(8)以太网UDP数据报文发送电路设计(二)
网络·笔记·学习·fpga开发
FPGA_小田老师17 小时前
FPGA例程(3):按键检测实验
fpga开发·verilog·vivado·led灯·按键测试
博览鸿蒙17 小时前
想考研到电子类,未来从事 FPGA/IC方向,目前该怎么准备?
考研·fpga开发
m0_5557629017 小时前
FPGA + AD7768-4 实现数据采集的可能方案
fpga开发
ShiMetaPi18 小时前
GM-3568JHF丨ARM+FPGA异构开发板系列教程:外设教程 09 CAN
arm开发·fpga开发·fpga·rk3568