Page 211 - MDP2020-2
P. 211

················································································  명장양성프로젝트  【MDP】  과제발표회  자료집  Ⅱ    |  205



                                end
                              else
                                begin
                                    rx_cnt  <=  rx_cnt  +  1;
                                end
                            end
                      end
                end


              always  @(posedge  clk,  negedge  rst)
                begin
                  if(!rst)
                      begin
                        rx_data  <=  0;
                      end
                    else
                      begin
                        if(state_rxd  ==  1)
                            begin
                              if(clk_cnt_  >=  BAUD_CLK  &&  rx_cnt  <  8)
                                begin
                                    rx_data[rx_cnt]  <=  uart_rxd;
                                end
                              else  if(clk_cnt_  >=  BAUD_CLK  &&  rx_cnt  ==  8  &&  uart_rxd  !=  1)
                                begin
                                    rx_data  <=  8'b00000000;
                                end
                              else
                                begin
                                  rx_data  <=  rx_data;
                                end
                            end
                      end
                end

              always  @(posedge  clk,  negedge  rst)
                begin
                  if(!rst)
                      begin
                        clk_cnt  <=  0;
                        clk_uart  <=  0;
                      end
                    else
                      begin
                        if(clk_cnt  >=  BAUD_CLK)
                          begin
                              clk_cnt  <=  0;
                              clk_uart  <=  1;
   206   207   208   209   210   211   212   213   214   215   216