摘要: Sim/circuit1 从波形不难看出ab是相与的关系。 module top_module ( input a, input b, output q );// assign q = a&b; // Fix me endmodule Sim/circuit2 根据波形图可以画出卡诺图并且之前有写过 阅读全文
posted @ 2022-11-08 12:09 Magnolia666 阅读(280) 评论(0) 推荐(0) 编辑
摘要: Bugs mux2 原本代码的逻辑是反的,这不是坑人吗。 module top_module ( input sel, input [7:0] a, input [7:0] b, output [7:0]out ); assign out = ({8{sel}} & a) | ({8{~sel}} 阅读全文
posted @ 2022-11-07 18:46 Magnolia666 阅读(125) 评论(0) 推荐(1) 编辑
摘要: Exams/review2015 count1k 计数到999再清零即可。 module top_module ( input clk, input reset, output reg[9:0] q); always@(posedge clk) begin if(reset) q <= 'd0; e 阅读全文
posted @ 2022-11-07 12:39 Magnolia666 阅读(365) 评论(0) 推荐(0) 编辑
摘要: Fsm1 这里需要实现一个简单的摩尔状态机,即输出只与状态有关的状态机。 我这里代码看上去比长一点,答案用的case和三目运算符,结果是一样的。 module top_module( input clk, input areset, // Asynchronous reset to state B 阅读全文
posted @ 2022-11-06 22:51 Magnolia666 阅读(426) 评论(0) 推荐(0) 编辑
摘要: Rule90 第一次见这东西有点莫名其妙,但是其实看懂了之后就是左移和右移相异或,注意这里使用的是逻辑右移,会自动补零,不能使用算数左移<<<。 module top_module( input clk, input load, input [511:0] data, output reg[511: 阅读全文
posted @ 2022-11-01 16:29 Magnolia666 阅读(99) 评论(0) 推荐(0) 编辑
摘要: Shift4 异步复位同步置数和使能。 module top_module( input clk, input areset, // async active-high reset to zero input load, input ena, input [3:0] data, output reg 阅读全文
posted @ 2022-10-31 12:17 Magnolia666 阅读(103) 评论(0) 推荐(0) 编辑
摘要: Count15 module top_module ( input clk, input reset, // Synchronous active-high reset output [3:0] q); always@(posedge clk) begin if(reset) q <= 4'd0; 阅读全文
posted @ 2022-10-30 21:27 Magnolia666 阅读(300) 评论(0) 推荐(0) 编辑
摘要: Dff 这一节终于开始时序电路了。首先是一个用的最多的D触发器。 module top_module ( input clk, // Clocks are used in sequential circuits input d, output reg q );// // Use a clocked 阅读全文
posted @ 2022-10-29 18:06 Magnolia666 阅读(243) 评论(0) 推荐(0) 编辑
摘要: Kmap1 化简卡诺图即可。 module top_module( input a, input b, input c, output out ); assign out=b|c|a; endmodule Kmap2 我是这样化简的。 module top_module( input a, inpu 阅读全文
posted @ 2022-10-28 12:25 Magnolia666 阅读(365) 评论(0) 推荐(0) 编辑
摘要: Mux2to1 module top_module( input a, b, sel, output out ); assign out=sel?b:a; endmodule Mux2to1v 100位和1位的是一样的。 module top_module( input [99:0] a, b, i 阅读全文
posted @ 2022-10-27 11:14 Magnolia666 阅读(122) 评论(0) 推荐(0) 编辑