2012年10月20日 星期六

4 Bit Serial Shift Register

源自
http://www.bitsbyta.com/2011/04/verilog-code-for-4-bit-serial-shift.html



Verilog Code For 4 Bit Serial Shift Register | Verilog Example Codes

Here is verilog code for implementation of a 4 bit serial shift register. See that the implementation has been done using non-blocking assignment operator (<=). If this was done with the help of blocking assignment operator (=), the case would be different. the similar code written using blocking statements would synthesize to a different circuit during synthesis.
This behavior is due to the fact that blocking assignment operators execute one-by-one while, non-blocking assignment operators execute concurrently during simulation.

module serial_shift (a, e, clock, reset);

output a;
input clock, reset;
input e;
reg a, b, c, d;

always @ (posedge clock or posedge reset)

 if (reset) begin a<=0, b<=0, c<=0, d<=0; end

 else begin

a<=b;
b<=c;
c<=d
d<=e;
 end
end
endmodule   

沒有留言:

張貼留言

零成本學 ESP32!在 Wokwi 打造你的第一個微型氣象站 (ESP32 + DHT22 + 1602 LCD)

零成本學 ESP32!在 Wokwi 打造你的第一個微型氣象站(溫度 濕度) (ESP32 + DHT22 + 1602 LCD) 想學物聯網(IoT)與 ESP32 電子實作,卻擔心接線與電壓規範搞砸嗎?透過強大的線上模擬器 Wokwi ,我們不需要花費任何硬體費用,打開瀏覽器...