HDLbits 刷题答案 3.2.3 Shift Registers

verilog学习 | HDLBits:在线学习答案 HDLBits 在提供 Verilog 基础语法教程的同时,还能够在线仿真 Verilog 模块。 阅读详情

3.2.3 Shift Registers

3.2.3.1 4-bit shift register

设计一个4bit异步复位,拥有同步置位和使能的右移移位寄存器。

  • areset : 寄存器复位为0
  • load : 将data[3:0]输入至移位寄存器中
  • ena : 使能信号控制向右移动(q[3]q[2]q[1]q[0] —> 0q[3]q[2]q[1],q[0]在移动后消失了,原先q[3]的位置变为0)
  • q: The contents of the shift register

如果load 和 ena都有效,load 的优先级更高

module top_module(
    input clk,
    input areset,  // async active-high reset to zero
    input load,
    input ena,
    input [3:0] data,
    output reg [3:0] q); 
    
    always @ (posedge clk or posedge areset) begin
        if(areset) begin
			q <= 4'd0;
        end
        else if(load) begin
           	 q <= data;
        end
        else if(ena) begin
            q <=  {1'b0, q[3:1]};
        end
    end
endmodule

3.2.3.2 Left/right ratator

设计一个100-bit的左/右移的移位寄存器,有同步置位信号load和同步左/右移使能信号ena
循环移位形式,不会舍弃某1bit也不会补0

  • load:将data[9:0]输入至寄存器内
  • ena[1:0]:选择是否移位或移位的方向
  • 2'b01:右移一位
  • 2'b10:左移一位
  • 2'b00和2'b11不移动
  • 移位寄存器内的数据
module top_module(
    input clk,
    input load,
    input [1:0] ena,
    input [99:0] data,
    output reg [99:0] q); 
	
    always @ (posedge clk) begin
        if(load) begin
           	q <= data; 
        end
        else if(ena == 2'b01) begin
            q <= {q[0],q[99:1]}; 
        end
        else if(ena == 2'b10) begin
            q <= {q[98:0],q[99]}; 
        end
    end
endmodule

3.2.3.3 Left/right arithmetic shift by 1 or 8

设计一个64-bit带同步置位的算法移位寄存器,该寄存器可以通过amount控制移动方向和每次移动的位数。

算术右移移位寄存器中的符号位q[63]移位,不像是逻辑右移中进行补零的操作,而是保留符号位后再进行移位

左移移位寄存器和算法移位寄存器没有区别

  • load:将·data[63:0`赋值为移位寄存器
  • ena:选择是否移位
  • amount:选择移动方向和移位次数
  • 2’b00 : 左移1bit
  • 2’b01 : 左移8bits
  • 2’b10 : 右移1bit
  • 2’b11 : 右移8bits
module top_module(
    input clk,
    input load,
    input ena,
    input [1:0] amount,
    input [63:0] data,
    output reg [63:0] q); 
    
    always @ (posedge clk) begin
        if(load) begin
            q <= data;
        end
        else if(ena)begin
            if(amount == 2'b00) begin
                q <= {q[62:0],1'b0};
            end
            else if(amount == 2'b01) begin
                q <= {q[55:0],8'b0}; 
            end
            else if(amount == 2'b10) begin
                q <= {q[63],q[63:1]}; 
            end
            else if(amount == 2'b11) begin
                q <= {{8{q[63]}},q[63:8]}; 
            end
        end
    end
endmodule

3.2.3.4 5-bit LFSR

线性反馈移位寄存器(LFSR)通常带有一个异或门来产生下一个状态的移位寄存器。Galois LFSR是一个特殊的移位寄存器,其中带有"tap"位的位置与输出位XOR产生下一个值没有"tap"位标志的正常移位。如果"tap"位置经过仔细选择后,LFSR将设置为最大长度。再重复之前LFSR的最大长度为2^n-1。

下图所示LFSR为在位置5和位置3包含"tap"位的5-bit最大长度LFSR。开始为位置1,输入为0。

设计如上图所示LFSR,复位信号使LFSR复位为1.

module top_module(
    input clk,
    input reset,    // Active-high synchronous reset to 5'h1
    output [4:0] q
); 
    always @ (posedge clk) begin
        if(reset) begin
           	q <= 4'd1; 
        end
        else begin
            q[4] <= 0 ^ q[0];
            q[3] <= q[4];
            q[2] <= q[3] ^ q[0];
            q[1] <= q[2];
            q[0] <= q[1];
        end
    end
endmodule

3.2.3.5 3-bit LFSR

使用Verilog实现上述功能,允许建立子模块,但顶层模块要命名为top_module

将输入端口R连接到板子上的拨动开关,clock 端口接到按键 KEY[0],端口 L 接到按键 KEY[1]。输出端口 Q 连接到板子上的红色 LED。

module top_module (
	input [2:0] SW,      // R
	input [1:0] KEY,     // L and clk
	output [2:0] LEDR);  // Q
	
    wire clk = KEY[0];
    wire sel = KEY[1];
    /*if (sel == 1)
    	q0 = r0;
        q1 = r1;
        q2 = r2;
      if(sel == 0)
      q0 = q2;
      q1 = q0;
      q2 = q2 ^ q1;
    */
    wire [2:0] d = sel ? SW : {LEDR[2] ^ LEDR[1], LEDR[0], LEDR[2]};
    always @ (posedge clk) begin
        LEDR <= d;
    end
endmodule

3.2.3.6 32-bit LFSR

建立一个32-bit的Galois LFSR,tap位于32,22,2和1

module top_module(
    input clk,
    input reset,    // Active-high synchronous reset to 32'h1
    output [31:0] q
);   
    always @ (posedge clk) begin
        if(reset) begin
           	q <= 32'b1; 
        end
        else begin
            q <= {q[0] ^ 0, q[31:23], q[22] ^ q[0], q[21:3], q[2] ^ q[0], q[1] ^ q[0]};
        end
    end
endmodule

3.2.3.7 Shift register

实现该电路

module top_module (
    input clk,
    input resetn,   // synchronous reset
    input in,
    output out);
    
    reg q0;
    reg q1;
    reg q2;
   
    always @ (posedge clk) begin
        if(!resetn) begin
            q0 <= 0;
            q1 <= 0;
            q2 <= 0;
            out <= 0; 
        end
        else begin
            q0 <= in;
            q1 <= q0;
            q2 <= q1;
            out <= q2;
        end
    end
endmodule

复位的时候,需要把q0,q1和q2也置零,否则运行结果不对

3.2.3.8 Shift register

写一个顶层的Verilog (命名top_module),假设n=4

写一个子模块,命名MUXDFF,通过例化的形式实现上述电路

其中:

  • R连接SW
  • clk连接KEY[0]
  • E --> KEY[1]
  • L --> KEY[2]
  • W --> KEY[3]
  • 输出连接到LEDR[3:0]
module top_module (
    input [3:0] SW,
    input [3:0] KEY,
    output [3:0] LEDR
); //
    MUXDFF u3 (.clk(KEY[0]), .e(KEY[1]), .l(KEY[2]), .w(KEY[3]), .r(SW[3]),.dout(LEDR[3]));
    MUXDFF u2 (.clk(KEY[0]), .e(KEY[1]), .l(KEY[2]), .w(LEDR[3]), .r(SW[2]),.dout(LEDR[2]));
    MUXDFF u1 (.clk(KEY[0]), .e(KEY[1]), .l(KEY[2]), .w(LEDR[2]), .r(SW[1]),.dout(LEDR[1]));
    MUXDFF u0 (.clk(KEY[0]), .e(KEY[1]), .l(KEY[2]), .w(LEDR[1]), .r(SW[0]),.dout(LEDR[0]));
endmodule

module MUXDFF (clk,e,l,w,r,dout);
    input clk;
    input e;
    input l;
    input w;
    input r;
    output dout;
    
    reg dout;

    always @ (posedge clk) begin
        if(l) begin
           	dout <= r;
        end
        else  begin
            if(e) begin
                dout <= w;
            end
            else begin
               	dout <= dout; 
            end
        end
    end
endmodule

3.2.3.9 3-input LUT
在这个中,将设计一个8x1存储器的电路,其中写入存储器是通过移位完成的,读取是“随机访问”,就像在一个典型的 RAM 中一样。然后,将使用电路实现一个3输入逻辑功能。

首先用8个D触发器创建一个8-bit移位寄存器,寄存器的输出记作q[7]......q[0],移位寄存器的输入记作S,并连接到q[0],enable控制是否进行移位

扩展电路中,有三个额外输入端A,B,C和一个输出端Z,当ABC=0时,Z=q[0],当ABC=001时,Z=q[1]…

module top_module (
    input clk,
    input enable,
    input S,
    input A, B, C,
    output Z ); 
    
    reg [7:0] q;
    
    always @ (posedge clk) begin
        if(enable) begin
          /*q[0] <= S;
            q[7:1] <= q[6:0];*/
            q <= {q[6:0],S};
        end
    end
    
    always @ (A or B or C) begin
        case ({A,B,C})
            3'b000 : Z = q[0];
            3'b001 : Z = q[1];
            3'b010 : Z = q[2];
            3'b011 : Z = q[3];
            3'b100 : Z = q[4];
            3'b101 : Z = q[5];
            3'b110 : Z = q[6];
            3'b111 : Z = q[7];
        endcase
    end
endmodule
HDLBits全部解答 HDLbits全部解答。 有始有终,断断续续用了一个月左右的时间才完成。希望可以坚持学习,持续进步。 阅读详情

相关推荐

HDLBits答案合集(一)

本文为本人HDL刷题代码,如有问题请及时联系 文章目录前言一、Getting Started1.1 Step one1.2 Zero二、Verilog language2.1 Basics2.1.1 wire2.1.2 Wire42.1.3 Notgate2.1.4 Andgate2.1.5 Norgate2.1.6 Xnorgate2.1.7 Wire decl2.1.8 74582.2 vectors2.2.1 vector02.2.2 Vector12.2.3 Vector22.2.4 Vecto.

南边的柴柴的博客 1万+

【HDLBits 刷题】所有答案直达链接汇总

以下为HDLBits全部答案,有些题的解法不唯一,我的也许不是最优解,欢迎提出更好的想法,HDLBits总的来说比较适合初学者,对于有一定基础希望进阶,或者是想要了解关于校招的笔试题相关题目,建议可以刷牛客网上的题,里面的试题包括基础和进阶以及企业校招真题。以下为牛客网刷题网站直达链接。☞牛客网刷题直达链接涵盖基础、进阶真题以及各类企业真题。

记录学习历程 3万+

HDLBits答案汇总

前言 该博客为本人做HDLBits习题时的心得记录总结,欢迎大家一起交流进步。 HDLBits网站链接 Verilog Language Basics Vectors Modules:Hierarchy Procedures More Verilog Features Circuits Combinational Logic Basic gates Multiplexers Arithmetic Circuits Karnaugh Map to Circuit Sequential Logic Latche

谦豫 9万+

刷完这套题,我才发现Verilog原来如此简单----HDLBits答案系列 -- Finite State Machine

给大家推荐一个非常好的练习Verilog的网站,有一两百道题,基本涵盖了Verilog语法的方方面面,是一个非常好的入门学习网站。网站连接:HDLBits

孤独的单刀 1万+

HDL bits 网站刷题答案

这是HDL bits 刷题网站上的答案 大家可以参考下,里面的答案很全面,仅供参考,想要提升还是需要自己写,而不是嫖

中断向量表配置不当引发Default_Handler死循环问题解析

本文深入解析STM32开发中因中断向量表配置不当导致的Default_Handler死循环问题。以STM32F407VET6为例,详细阐述中断向量表的工作原理、常见触发场景及系统化排查方法,并提供使用STM32CubeMX的正确姿势和手动配置的注意事项,帮助开发者快速定位并解决这一常见难题。

grafana6viz的博客 180

HDLBits 刷题分享 Shift Registers Verilog零基础刷题教程

文章包含了9个题目的完整解答,涵盖基础移位寄存器、循环移位、算术移位以及线性反馈移位寄存器(LFSR)等内容。重点讲解了移位操作符的使用、异步与同步复位的区别、优先级控制等核心概念,并通过代码示例和详细注释解释了硬件实现原理。文章以实践为导向,旨在帮助读者掌握移位寄存器在FPGA设计中的应用。

pinashunsui的博客 1307

RK3576的ISP和VPSS图像处理能力实测:对比海思方案能做什么?

本文深度评测了RK3576芯片的ISP和VPSS图像处理能力,并与海思方案进行对比。测试显示,RK3576在MIPI接口灵活性、多路视频支持、HDR动态范围和降噪效果等方面表现优异,特别适合智能视觉和安防监控应用。通过实测数据展示了其在低照度、高动态范围等复杂场景下的卓越性能。

weixin_42713608的博客 265

【HDLBits习题详解 2-2】Circuit - Sequential Logic(3)Shift Registers

【HDLBits习题 2】Circuit - Sequential Logic(3)Shift Registers

ZEROZibER的博客 475

使用Label Studio标注车牌数据:YOLOv26模型训练指南

在计算机视觉领域,数据标注是模型训练的基础环节,直接影响最终模型的识别精度。Label Studio作为专业的标注工具,支持多种标注类型和格式导出,特别适合目标检测任务的数据准备。通过多边形标注技术,可以精确捕捉车牌的四个角点,生成旋转矩形框(OBB)标注数据,这种标注方式相比传统水平框能更好地处理倾斜车牌场景。标注完成后,数据可导出为YOLO格式,直接用于YOLOv26等先进目标检测模型的训练。在实际工程中,合理的标注策略和严格的质量控制能显著提升车牌识别模型在复杂场景下的鲁棒性,适用于智能交通、停车场管

chuozhi7142的博客 904

手把手教你用Python分析OpenFAST仿真结果:pyDatView处理.out文件与数据可视化技巧

本文详细介绍了如何使用Python中的pyDatView工具分析OpenFAST仿真结果,包括数据加载、质量检查、时域与频域分析、多工况对比及自动化报告生成。通过优化技巧和可视化方法,帮助工程师高效处理.out文件,提升风机性能分析的准确性和效率。

weixin_29311017的博客 184

HDLbits 刷题答案practice——Shift Registers

HDLbits 刷题练习,Shift Registers部分

qq_43508759的博客 387

【立创开源】太阳能板充电方案单节3.7v锂电池充电

一直对太阳能板感兴趣,老是感觉充电好麻烦,要是放在那里就可以自己充电多好,所以尝试做了一个太阳能充电板。因为这几天都是阴天,所以测试效果不太好,但是下雨天也是能充电的,但是基本只能维持电量不掉,电压差不多4.2v以上,电流只有2mA。中午出太阳的时候,隔着玻璃放在太阳下测试,电流有12mA以上。能充起一点点电。等大晴天看一看能不能达到卖家说50mA。┗( T﹏T )┛感觉达不到。这个东西只能当一个玩具(;′⌒`)。不过如果汽车上一些行车记录仪加一个这个,汽车经常在太阳下停车,可能再也不用充电了。

贾saisai的博客 1万+

HDLbits答案更新系列9(3.2 Sequential Logic 3.2.3 Shift Registers)

今天更新一个小节内容,第三部分中Sequential Logic中的Shift Registers,里面涉及到线性反馈移位寄存器和查找表等, 希望大家可以掌握。我也希望能和大家一起学习,共同进步~

小k的博客 1万+

【踩坑记录】colmap中的相机位姿的坐标系定义及其可视化结果的隐含转换

1 坐标系定义及转换   首先介绍一下世界坐标系和相机坐标系之间的转换,它们之间是存在一个转换关系的。现假设空间中一点X,它在相机坐标系下的坐标是Xcamera,在世界坐标系下的坐标是Xworld。假设它通过R和t实现从相机坐标系到世界坐标系之间的转换: Xworld = RXcamera + t   那么,由上式,我们可以推得从世界坐标系向相机坐标系的转换关系(RT=R-1,所以通常直接使用RT即可): Xcamera = RTXworld - RTt   所以,两个坐标系之间的转换,需要看其具体

zeeq的博客 2万+

AEJoy —— 表达式之仅限在某一维摆动【JS】

效果图 wiggle() 的作用仅限于水平方向 想法 wiggle() 确实是一个非常方便的工具,但有时您希望对它有更多的控制。在本例中,我们希望仅将摆动限制在水平方向。 设计 要理解 wiggle() 最重要的一点是,它生成的结果与应用它的属性具有相同的维度。例如,如果你将 wiggle() 应用于 3D 层的 position 属性,结果将是一个由三个元素组成的数组(x、y 和 z 各一个)。我们需要做的就是将 wiggle() 的结果捕捉到一个变量(我们称之为 “w” ),然后从这个变量中提取我们想

ShaderJoy 的兴趣技术杂货铺 2095

HDLBits中文版,标准参考答案 | 3.2.3 Shift Registers | 移位寄存器

HDLBits中文版,标准参考答案 | 3.2.3 Shift Registers | 移位寄存器

望森FPGA的博客 1429

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

HDLBits答案13-Sequential:Shift Registers

文章目录1. 1.

sinat_41774721的博客 1191

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

HDLbits实战解析:从基础移位到LFSR,解锁时序逻辑核心(3.2.3 Shift Registers专题)

本文深入解析HDLbits时序逻辑专题中的移位寄存器(Shift Registers)与线性反馈移位寄存器(LFSR)核心设计。从基础的4位移位寄存器构建讲起,逐步进阶到旋转、算术移位操作,并重点剖析了LFSR的工作原理与Verilog实现,帮助读者掌握时序逻辑设计的核心范式与实战技巧。

weixin_29250403的博客 558

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

HDLBits-shift registers

HDLBit刷题

qq_46075386的博客 233

【HDLBits 刷题 8】Circuits(4)Sequential Logic---Shifts Registers & More Circuits

本篇博客对 Circuits 部分的组合逻辑前两节做答案和部分解析,一些比较简单的题目就直接给出答案,有些难度再稍作讲解,每道题的答案不一定唯一,可以有多种解决方案,欢迎共同讨论。

记录学习历程 3770

Hdlbits->circuits->shift registers

【代码】Hdlbits->circuits->shift registers。

weixin_50367479的博客 244

HDLbits练习答案(完) 只有你一个success啊

1.Verilog Language 1.1 Basics 1.1.1 Simple wire 1.1.2 four wires 1.1.3 Inverter 1.1.4 AND gate 1.1.5 Norgate 1.1.6 Xnorgate 1.1.7 Wire decl 1.1.8 7458 1.2Vectors 1.2.1 Vectors 1.2.2 Vectors in more detail 1.2.3 Vector part select 1.2.4 Bitw 1.2.5 Four-inp

weixin_43167279的博客 2万+

【HDLBits答案及思路(仅供参考,1 Getting Started与2 Verilog Language)】

HDLBits学习笔记,答案分享

qq_45141192的博客 9207

HDLBits 答案 (更新中)

Verilog练习网站HDLbits答案缓更中,欢迎讨论交流。

ooFoo_的博客 420
上一篇: HDLbits 刷题答案 3.2.2 Counters
下一篇: HDLbits 刷题答案 3.2.4 More Circuit
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值