摘要: `timescale 1ns/1ns module sequence_detect( input clk, input rst_n, input a, output reg match ); reg [8:0] temp_a; always @(posedge clk,negedge rst_n) 阅读全文
posted @ 2024-08-29 16:25 段星儿 阅读(16) 评论(0) 推荐(0)
摘要: 这个题目的意思是输入是单bit脉冲,然后当8个周期的脉冲序列符合给定的参数值则match输出1; 因此肯定需要一共8位的寄存器存储总共8个a的输入脉冲 此外由于是从左向右匹配,因此每个周期输入的a要从寄存器最低位输入,从右向左移位(temp_a<={temp_a[6:0],a};),这样才是输入满足 阅读全文
posted @ 2024-08-29 16:16 段星儿 阅读(30) 评论(0) 推荐(0)
摘要: 这个就是需要对a 进行打一拍last_a<=a; 需要理解的点是打一拍的last_a是落后a一个时钟周期的,也就是对当前时刻使用a时候,此时的last_a是a的上一时刻的值。 `timescale 1ns/1ns module edge_detect( input clk, input rst_n, 阅读全文
posted @ 2024-08-26 17:12 段星儿 阅读(14) 评论(0) 推荐(0)
摘要: reg [3:0] rom [7:0];变量名称rom之前的[3:0]表示每个数据具有多少位,指位宽;变量名称rom之后的[7:0]表示需要多少个数据,指深度,注意这里深度为8(和输入地址addr一致); always 里面的else部分的写法是难点,这里是因为只需要初始化,其余状态就保持存储的原因 阅读全文
posted @ 2024-08-26 16:57 段星儿 阅读(16) 评论(0) 推荐(0)
摘要: 和上一题的第一段完全相同,第二段只是根据状态转移有部分改变,本体使用三段式状态机来写,第三段写法和上一题不一样。 `timescale 1ns/1ns module seq_circuit( input C , input clk , input rst_n, output wire Y ); re 阅读全文
posted @ 2024-08-26 16:31 段星儿 阅读(48) 评论(0) 推荐(0)
摘要: 根据给的状态转移表知道有两个状态:第一列的为current_state,第二三列为next_state,且仅当current_state==11时候Y为1(使用()?:语法实现)。 三段式状态机的流程: 第一段:时序逻辑,公式化写法 第二段:组合逻辑,这里要注意always @(*)是固定写法,不能 阅读全文
posted @ 2024-08-26 16:16 段星儿 阅读(55) 评论(0) 推荐(0)
摘要: `timescale 1ns/1nsmodule encoder_83( input [7:0] I , input EI , output wire [2:0] Y , output wire GS , output wire EO );assign Y[2] = EI & (I[7] | I[6 阅读全文
posted @ 2024-08-15 16:07 段星儿 阅读(205) 评论(0) 推荐(0)
摘要: `timescale 1ns/1ns module encoder_0( input [8:0] I_n , output reg [3:0] Y_n ); always @(*)begin casex(I_n) 9'b1_1111_1111 :Y_n=4'b1111; 9'b0_xxxx_xxxx 阅读全文
posted @ 2024-08-15 10:15 段星儿 阅读(34) 评论(0) 推荐(0)
摘要: `timescale 1ns/1ns module lca_4( input [3:0] A_in , input [3:0] B_in , input C_1 , output wire CO , output wire [3:0] S ); reg [3:0] C; reg [3:0] G; r 阅读全文
posted @ 2024-08-15 09:22 段星儿 阅读(29) 评论(0) 推荐(0)
摘要: 新建二维模型 几何-先确定长度单位为mm 几何-矩形-宽度设置8mm,高度2mm 几何-圆-扇形角设置180deg 形成联合体-全部构建 阅读全文
posted @ 2023-08-29 11:25 段星儿 阅读(213) 评论(0) 推荐(0)