Shift Register

/***************************************************

/  Shift Register module

/  Programing by seongki

***************************************************/

module Shift_Register_4_beh(output reg [3:0] A_par,input [3:0] I_par, input s1,s0, MSB_in,LSB_in,CLK,Clear);

[email protected](posedge CLK,negedge Clear)

if(~Clear)A_par<=4‘b0000;

else

case({s1,s0})

2‘b00:A_par<=I_par;

2‘b01:A_par<={MSB_in,I_par[3:1]};

2‘b10:A_par<={I_par[2:0],LSB_in};

2‘b11:A_par<=I_par;

endcase

endmodule

// testbench

`timescale 1ns/1ns

module tb_Shift_Register_4_beh;

reg [3:0] I_par;

reg s1,s0,MSB_in,LSB_in,CLK,Clear;

wire [3:0] A_par;

Shift_Register_4_beh test1(A_par,I_par,s1,s0, MSB_in,LSB_in,CLK,Clear);

initial

  begin

    I_par=4‘b1111;

    Clear=0; MSB_in=0; LSB_in=0; CLK=0; s1=0; s0=0;

    #10 CLK=0;

    #10 CLK=1;

    #10 CLK=0;

    #10 CLK=1;

    #10 CLK=0;

    #10 CLK=1; 

    #10 Clear=1; MSB_in=0; LSB_in=0; CLK=0; s1=0; s0=0;

    #10 CLK=0;

    #10 CLK=1;

    #10 CLK=0;

    #10 CLK=1;

    #10 CLK=0;

    #10 CLK=1;

    #10 Clear=1; MSB_in=0; LSB_in=0; CLK=0; s1=0; s0=1;

    #10 CLK=0;

    #10 CLK=1;

    #10 CLK=0;

    #10 CLK=1;

    #10 CLK=0;

    #10 CLK=1;

    #10 Clear=1; MSB_in=0; LSB_in=0; CLK=0; s1=1; s0=0;

    #10 CLK=0;

    #10 CLK=1;

    #10 CLK=0;

    #10 CLK=1;

    #10 CLK=0;

    #10 CLK=1;

    #10 Clear=1; MSB_in=0; LSB_in=0; CLK=0; s1=1; s0=1;

    #10 CLK=0;

    #10 CLK=1;

    #10 CLK=0;

    #10 CLK=1;

    #10 CLK=0;

    #10 CLK=1;

    #10 CLK=0;

  end

endmodule

时间: 2024-07-30 10:18:52

Shift Register的相关文章

Shift Register(Using Submodule)

/*************************************************** /  Shift Register module by Submodule /  Programing by seongki ***************************************************/ module Shift_Register_4_str(output [3:0] A_par,input [3:0] I_par,input s1,s0,MSB_

RAM-Based Shift Register (ALTSHIFT_TAPS) IP Core-实现3X3像素阵列存储

最近想要实现CNN的FPGA加速处理,首先明确在CNN计算的过程中,因为卷积运算是最耗时间的,因此只要将卷积运算在FPGA上并行实现,即可完成部分运算的加速 那么对于卷积的FPGA实现首先要考虑的是卷积子模板具体如何实现,我们在matlab或者c实现比如3X3的子模板的时候,只要用一个数组即可将模板的数据存储起来,而在FPGA的话有以下三种方法: 用2个或3个RAM存储3X3像素阵列 用2个或3个FIFO存储3X3像素阵列 用shift_RAM移位存储3X3像素阵列 而shift_RAM好像就是

imx6 ECSPI Config Register 中SS_CTL的使用

1.采用 slave 模式 2.SS_CTL 配置为0 imx6 中关于该位的配置说明如下: 其中: In slave mode - an SPI burst is completed when the number of bits received in the shift register isequal to (BURST LENGTH + 1). Only the n least-significant bits (n = BURST LENGTH[4:0] + 1) of thefir

树莓派wiringPi库详解

wiringPi是一个很棒的树莓派控制API,使用C语言开发,提供了丰富的接口:GPIO控制,中断,多线程,等等.java 的pi4j项目也是基于wiringPi的,我最近也在看源代码,到时候整理好了会放出来的. 下面开始wiringPi之旅吧! 安装 进入  wiringPi的github (https://git.drogon.net/?p=wiringPi;a=summary)下载安装包.点击页面的第一个链接的右边的snapshot,下载安装压缩包. 然后进入安装包所在的目录执行以下命令:

orcad常用库文件

ORCAD CAPTURE元件库介绍 AMPLIFIER.OLB amplifier 共182个零件,存放模拟放大器IC,如CA3280,TL027C,EL4093等. ARITHMETIC.OLB arithmetic 共182个零件,存放逻辑运算IC,如TC4032B,74LS85等. ATOD.OLB 共618个零件,存放A/D转换IC,如ADC0804,TC7109等. BUS DRIVERTRANSCEIVER.OLB 共632个零件,存放汇流排驱动IC,如74LS244,74LS37

推荐 的FPGA设计经验(3) 物理实现和时间闭环优化

Optimizing Physical Implementation and Timing Closure Planning Physical Implementation When planning a design, consider the following elements of physical implementation:? The number of unique clock domains and their relationships? The amount of logi

spi协议及工作原理分析

转自----http://blog.csdn.net/skyflying2012/article/details/11710801 一.概述. SPI, Serial Perripheral Interface, 串行外围设备接口, 是 Motorola 公司推出的一种同步串行接口技术. SPI 总线在物理上是通过接在外围设备微控制器(PICmicro) 上面的微处理控制单元 (MCU) 上叫作同步串行端口(Synchronous Serial Port) 的模块(Module)来实现的, 它允

AES advanced encryption standard

// advanced encryption standard // author: karl malbrain, [email protected] typedef unsigned char uchar; #include <string.h> #include <memory.h> // AES only supports Nb=4 #define Nb 4 // number of columns in the state & expanded key #defin

Flexible implementation of a system management mode (SMM) in a processor

A?system?management?mode?(SMM) of operating a processor includes only a basic set of hardwired hooks or mechanisms in the processor for supporting SMM. Most of SMM functionality, such as the processing actions performed when entering and exiting SMM,