HDLBits学习------Problem 163~172

本文档详细解析了五种组合逻辑电路(与门、卡洛图应用、简化表达)和三种时序电路(触发器、计数器、复位模7计数器),通过实例展示了如何通过仿真波形理解和实现电路设计。涉及模块编写和逻辑分析技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Problem 163 Combinational circuit 1

        问题:通过仿真波形实现电路

        思路:通过波形可以看出来是一个与门

        解决:

module top_module (
    input a,
    input b,
    output q );//

    assign q = a & b; // Fix me

endmodule

        居然一开始看成了同或门


Problem 164 Combinational circuit 2

        问题:通过仿真波形实现电路

        思路:画卡洛图

        解决:Problem 75取反就好了Problem 75

module top_module (
    input a,
    input b,
    input c,
    input d,
    output q );//

    
    assign q = ~((~a&b&~c&~d) | (a&~b&~c&~d) | (~a&~b&~c&d) |  (a&b&~c&d) |  (~a&b&c&d) |  (a&~b&c&d) |  (~a&~b&c&~d) |  (a&b&c&~d)); 

endmodule

Problem 165 Combinational circuit 3

        问题:通过仿真波形实现电路

        思路:画卡洛图 化简卡洛图

        解决:

module top_module (
    input a,
    input b,
    input c,
    input d,
    output q );//

    assign q = a&d | a&c | b&d | b&c; // Fix me

endmodule

Problem 166 Combinational circuit 4

        问题:通过仿真波形实现电路

        思路:画卡洛图 化简卡洛图

        解决:

module top_module (
    input a,
    input b,
    input c,
    input d,
    output q );//

    assign q = b | c; // Fix me

endmodule

Problem 167 Combinational circuit 5

        问题:通过仿真波形实现电路

        解决:

module top_module (
    input [3:0] a,
    input [3:0] b,
    input [3:0] c,
    input [3:0] d,
    input [3:0] e,
    output [3:0] q );
    
    always @(*) begin
		case(c)
			4'h0: q = b;
			4'h1: q = e;
			4'h2: q = a;
			4'h3: q = d;
			default: q = 4'hf;
		endcase
	end

endmodule

Problem 168 Combinational circuit 6

        问题:通过仿真波形实现电路

        解决:

module top_module (
    input [2:0] a,
    output [15:0] q ); 

    always @(*) begin
		case(a)
			3'd0: q = 16'h1232;
			3'd1: q = 16'haee0;
			3'd2: q = 16'h27d4;
			3'd3: q = 16'h5a0e;
			3'd4: q = 16'h2066;
			3'd5: q = 16'h64ce;
			3'd6: q = 16'hc526;
			3'd7: q = 16'h2f19;
		endcase
	end

endmodule

Problem 169 Sequential circuit 7

        问题:这是一个时序电路 通过仿真波形实现电路

        解决:

module top_module (
    input clk,
    input a,
    output q );

    always @(posedge clk) begin
		q <= ~a;
	end

endmodule

Problem 170 Sequential circuit 8

        问题:这是一个时序电路 通过仿真波形实现电路

        解决:

module top_module (
    input clock,
    input a,
    output p,
    output q );

    assign p = clock ? a : p;
	
	always @(negedge clock) begin
		q <= a;
	end
    
endmodule

        从图中来说,感觉下降沿q = ~q不也是对的嘛,可能要和输入扯上关系才行吧


Problem 171 Sequential circuit 9

        问题:这是一个时序电路 通过仿真波形实现电路

        思路:这就是个带复位的 模为7的计数器

        解决:

module top_module (
    input clk,
    input a,
    output [3:0] q );
    
    always @(posedge clk) begin
		if(a)
			q <= 4'd4;
		else begin
            if(q < 4'd6)
				q <= q + 1'b1;
			else
				q <= 4'd0;
		end
	end

endmodule

Problem 172 Sequential circuit 10

        问题:这是一个时序电路  该电路由组合逻辑和一个触发器组成 通过仿真波形实现电路

         解决:解法来源:解答

module top_module (
    input clk,
    input a,
    input b,
    output q,
    output state  );
    
    always @(posedge clk) state <= state ? a|b : a&b;
    assign q = a^b^state;
 
endmodule

(自己看了很久也不知道怎么做,就写出一个state来)

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值