Silent Solitude 2021-04-26 17:13 采纳率: 100%
浏览 103
已采纳

【Verilog语言】怎么让数码管显示实现数字和*号自由切换?开发板上有一个空余的按键可以用来触发。

	/*数码管显示部分*/
/***********************************************************************/	
	always @ (posedge Clk, negedge Rst_n)
	begin
		if (!Rst_n)
			Disp_data <= 32'haaaaaaaa;//32'hcccccccc
		else
			if (Key_flag == 1'b1 
				&& ((c_state ==IDLE && Key_value < 4'ha) 
				|| (c_state ==NUM_IN && Key_value < 4'ha)
				|| (c_state ==CHANGE && Key_value < 4'ha)))
				Disp_data <= {Disp_data[27:0], Key_value};
			else if (Key_flag == 1'b1 
				&& ((c_state ==IDLE && Key_value == 4'hc) 
				|| (c_state ==NUM_IN && Key_value == 4'hc)
				|| (c_state ==CHANGE && Key_value == 4'hc)))
				Disp_data <= 32'haaaaaaaa;
			else if (c_state ==IDLE || c_state == PASS || c_state == ERROR)
				Disp_data <= 32'haaaaaaaa;
			else
				Disp_data <= Disp_data;
	end
function [6:0] decode;
		input [3:0] in;
		begin
			case (in)
//				4'h0:decode[6:0] = 7'b1000000; /*0*/
//				4'h1:decode[6:0] = 7'b1111001; /*1*/
//				4'h2:decode[6:0] = 7'b0100100; /*2*/
//				4'h3:decode[6:0] = 7'b0110000; /*3*/
//				4'h4:decode[6:0] = 7'b0011001; /*4*/
//				4'h5:decode[6:0] = 7'b0010010; /*5*/
//				4'h6:decode[6:0] = 7'b0000010; /*6*/
//				4'h7:decode[6:0] = 7'b1111000; /*7*/
//				4'h8:decode[6:0] = 7'b0000000; /*8*/
//				4'h9:decode[6:0] = 7'b0010000; /*9*/
				4'h0:decode[6:0] = 7'b0111111; /*-*/
				4'h1:decode[6:0] = 7'b0111111; /*-*/
				4'h2:decode[6:0] = 7'b0111111; /*-*/
				4'h3:decode[6:0] = 7'b0111111; /*-*/
				4'h4:decode[6:0] = 7'b0111111; /*-*/
				4'h5:decode[6:0] = 7'b0111111; /*-*/
				4'h6:decode[6:0] = 7'b0111111; /*-*/
				4'h7:decode[6:0] = 7'b0111111; /*-*/
				4'h8:decode[6:0] = 7'b0111111; /*-*/
				4'h9:decode[6:0] = 7'b0111111; /*-*/
//				4'ha:decode[6:0] = 7'b0001000; /*a*/
				4'ha:decode[6:0] = 7'b1111111; /* */
				4'hb:decode[6:0] = 7'b0000011; /*b*/
//				4'hc:decode[6:0] = 7'b1000110; /*c*/
				4'hc:decode[6:0] = 7'b0111111; /*-*/
				4'hd:decode[6:0] = 7'b0100001; /*d*/
				4'he:decode[6:0] = 7'b0000110; /*e*/
				4'hf:decode[6:0] = 7'b0001110; /*f*/
			endcase
		end
	endfunction

希望能够告知代码或者是大致思路,如果可以解决的话麻烦加一下QQ1759779471,可以给50元作为报酬,谢谢。如果需要完整代码才可以解决也可以联系我。

  • 写回答

3条回答 默认 最新

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 关于selenium网页闪退
      • ¥15 怎么用PYTHON解类似于x = y+zx + cy = x+zy + v的方程
      • ¥300 FLASH AS2.0制作一个类似手机上下滑动一样的效果
      • ¥15 为什么使用openFoam 中的icoFoam计算圆柱扰流时出现浮点数例外(核心已转储)
      • ¥15 51单片机外部中断控制数码管
      • ¥15 创建网页里面的图片显示不出来
      • ¥15 语音控制的编写?(语言-c#)
      • ¥15 matlab输入书上的代码运行错误
      • ¥15 matlab怎么做三维曲面
      • ¥50 sph光滑粒子法能否解决阶跃性的问题