sasinop 发表于 2013-5-8 20:14:31

分频时钟,作为另模块输入时钟 请教

我想把 div分频后的时钟,作为UARTAutomatic 模块的输入时钟,怎么把下面两个模块和到一起呀?
谢谢

module UARTAutomatic   
(
    Clk,
    RSTn,
    /*port*/
    Rxd,
    Txd
);
input                     Clk ;
input                     RSTn ;
input                     Rxd ;

output                      Txd ;

wire                         Txd ;

wire                        SendRequest ;
wire                   DataIn ;
wire                   DataOut ;
wire                        ReceiveByteFinish ;
wire                        SendByteFinish ;

assign      SendRequest = ReceiveByteFinish ;
assign      DataIn = DataOut ;

UART    UARTEx01
(
    .Clk                  (    Clk                  ),
    .RSTn               (    RSTn               ),
    .Rxd                  (    Rxd                  ),
    .SendRequest          (    SendRequest          ),
    .DataIn               (    DataIn               ),
    .Txd                  (    Txd                  ),
    .DataOut            (    DataOut            ),
    .ReceiveByteFinish    (    ReceiveByteFinish    ),
    .SendByteFinish       (    SendByteFinish       )
);

endmodule

// 分频
module div(Clk,clkout);
input Clk;
output reg clkout;
reg count;
always@(posedge Clk) begin
if(count==27) begin
count<=0;
clkout<=~clkout;
end
else begin
count<=count+1;
clkout<=clkout;
end
end
endmodule

新人,目前水平,点灯阶段...

sasinop 发表于 2013-5-8 21:53:25

module toplayout
(
inputClk_in,
    inputRSTn,
    /*port*/
   input   Rxd,
   output Txd
);

wire clk_diver;
div diver1(.Clk(Clk_in),.clkout(clk_diver));
UARTAutomaticuart1 (.clk(clk_diver),.RSTn(RSTn),.Rxd(Rxd),.Txd(Txd));

endmodule

可否?
页: [1]
查看完整版本: 分频时钟,作为另模块输入时钟 请教