Advertisement

String/Bitwise Operations: String to Bit Operations and Vice Versa

阅读量:
  • 并转串(4位)
复制代码
    module pal_ser(
    input clk,
    input rst_n,
    input load
    input [3:0]din,
    output dout);
    reg [3:0] databuff;
    
    always @(posedge clk or negedge rst_n)
    if(!rst_n) databuff <= 4'b0;
    else if(load) databuff <= din;
    else databuff <= databuff << 1;
    assign dout = databuff[3];
    endmodule
    
    
      
      
      
      
      
      
      
      
      
      
      
      
      
      
    
  • 将串行结构转换为并行结构(4位)
复制代码
    module ser_pal(
    input clk,
    input rst_n,
    input en
    input cin,
    output cout);
    reg [3:0] cout;

全部评论 (0)

还没有任何评论哟~