2020年5月5日 星期二

以Verilog 設計一個數位電路 (12)--- Shift Rotate

以Verilog 設計一個數位電路 (12)--- Shift  Rotate


`timescale 1 ns/1 ns

module EX_112 (a, b, c, d);
input [7:0] a;
output [7:0] b, c, d;
wire [7:0] b, c, d;

assign b = { a[6:0], a[7] };

assign c = { a[0], a[7:1] };

assign d = { a[3:0], a[7:4] };


endmodule

`timescale 100 ns/1 ns

module testbench;
reg [7:0] a;
wire [7:0] b, c, d;

EX_112 UUT (
.a(a),
.b(b),
.c(c),
.d(d) );
initial
begin
 a   = 8'h0f; // Time = 0
 #50; // Time = 50
 a   = 8'h5a;
 #50
  $stop;
end
endmodule

沒有留言:

張貼留言

Modbus FC=1 (Coils read) & FC=15 (Coils Write)

Modbus FC=1  (Coils read)  & FC=15 (Coils Write)   「從 Modbus 設備讀取多個線圈(Coils)狀態,並立刻將這些狀態原封不動地轉寫到另一個記憶體位址(起始位址 16)」 。 整個流程使用了知名套件 node-red...