- 博客(17)
- 资源 (1)
- 收藏
- 关注
原创 UART 串口回环
接收部分:module uart_rev( input clk, input reset, input rxd, output [7:0] uart_data, output uart_done); parameter SYS_CLK=50000000; parameter BPS=9600; localparam BPS_CNT=SYS_CLK/BPS reg rxd_0,rxd_1;//RX数据延迟两拍,用来判断开
2022-03-16 17:39:38
534
原创 按键消抖VERILOG
module top_module( input clk, input reset, input [3:0] key_in, //按键输入 output [3:0] key_signal, //按键扫描 output [7:0] led); wire key;//4个按键输入相与来判断是否有按键被按下 assign key=&key_in; reg [3:0] key_value;//存入按键判断值,判断按下还是释放 w...
2022-03-11 16:59:40
946
原创 数码管驱动
module led(input clk,input reset,output reg[7:0] dtube_data,output reg[3:0] dtube_cs_n ); parameter NUM0 = 8'h3f,//c0, NUM1 = 8'h06,//f9, NUM2 = 8'h5b,//a4, NUM3 = 8'h4f,//b0, NUM4 = 8'h66,//99, NUM5 = 8'h6d,.
2022-03-06 19:06:00
159
原创 HDLBITS中的边沿检测
1.上升沿检测用一个寄存器来储存上个周期的输入,时钟周期到来时将寄存器输出位q。01时就为上升沿。module top_module ( input clk, input [7:0] in, output [7:0] pedge); reg [7:0] q; always@(posedge clk) begin q<=in; pedge<=~q∈ ...
2022-01-27 17:30:07
522
原创 Count clock
解析:需要实现一个时钟。分别建立一个60计数和12计数的BCD时钟.代码:module top_module( input clk, input reset, input ena, output pm, output [7:0] hh, output [7:0] mm, output [7:0] ss); reg[2:0] enable; //秒分时 使能 assign enable[0] = ena; ...
2022-01-24 11:25:52
432
原创 HDLBits_Fsm hdlc
序列检测:5个1,dsic输出1;6个1,flag输出1;7个或以上,err输出1。这题比较简单,直接附代码。module top_module( input clk, input reset, // Synchronous reset input in, output disc, output flag, output err); localparam none=0,s1=1,s2=2,s3=3,s4=4,s5=5,...
2021-12-15 11:31:33
183
原创 HDLBits:Serial Receiver系列问题
1.Serial receiver解析:module top_module( input clk, input in, input reset, // Synchronous reset output done); localparam idle=0,start=1,data=2,stop=3,error=4; reg[2:0] state,next; reg[3:0] cnt;//next always@(*...
2021-12-15 10:39:41
295
原创 HDLBits-Lemmings4
解析:Lemmings系列的最后一题。这题的要求是增加了一个死亡的判断,当向下坠落超过20个时钟周期,便会死亡,此时所有输出为0。需要增加一个计数器,最开始我把计数器和状态时序写在一个always块内,功能不知道为啥无法实现,输出没法置0,后面单独给计数器写个always块后可以实现。代码:module top_module( input clk, input areset, // Freshly brainwashed Lemmings walk left. ...
2021-12-13 14:53:06
296
原创 HDLBits_Lemmings3
解析:和Lemmings2类似,增了个挖地的功能,dig为0时,会进行挖地,一直挖到ground为0。思路类似,将左右挖地分开。代码:module top_module( input clk, input areset, // Freshly brainwashed Lemmings walk left. input bump_left, input bump_right, input ground, input dig, outp...
2021-12-10 16:07:47
286
原创 HDLBits--Lemmings2
题目:解析: 在Lemmings1中增加了一个ground信号,ground为0时,小人会掉下去,ground为1时,小人会恢复到掉下去之前的向左向右状态。所以想到把掉下去分成,从向左掉下去和从向右掉下去。代码如下:module top_module( input clk, input areset, // Freshly brainwashed Lemmings walk left. input bump_left, input bump_right,...
2021-12-08 14:38:45
328
原创 Exams/ece241 2013 q4:水位问题
module top_module ( input clk, input reset, input [3:1] s, output fr3, output fr2, output fr1, output dfr);parameter A=3'd0,B0=3'd1,B1=3'd2,C0=3'd3,C1=3'd4,D=3'd5;//6种状态,B0,B1分别代表从低水位往高水位和从高水外往低水位。 reg [2:0] state; ...
2021-12-08 09:55:11
323
原创 HDLBits-Simple FSM 3(asynhronous reset)
题目:解析:没什么内容,一个简单的状态机module top_module( input clk, input in, input areset, output out); // parameter A=0,B=1,C=2,D=3; reg[1:0] state,next_state; always@(*) begin case(state) ...
2021-12-07 15:57:35
188
华为PCB的EMC设计指南.PDF
2020-04-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人