亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? serial.v

?? vga ipcore的verilog代碼
?? V
?? 第 1 頁 / 共 2 頁
字號:
//-----------------------------------------------------------------------------
// module: serial.vhd
// This file contains modules for serial I/O.
//
// OVERVIEW of contents:  The clock generators are
//   configured to provide clocks at 16x the desired transmit
//   BAUD rates for RS232 serial I/O.  This is done so that
//   the rs232rx module can easily share the clock generation
//   circuitry of the rs232tx block.
//   The clock_gen_select module has a BAUD rate selection
//   input field of three bits.  This field allows the appropriate
//   "clock_factor" clock rate to be produced once and used on many
//   transmitters and receivers.
//   Alternatively, there is a "clock_gen" block which uses parameters
//   to specify the desired values for the DDS and prescaler divide factor.
//
// Author: John Clayton
// Date  : Nov.  7, 2000
// Update: Nov.  7, 2000 Created this file, with RS232tx block only
//                       The rs232tx block has no double buffering.
// Update: Nov.  9, 2000 Separated clock generator circuitry into "clock_gen"
// Update: Nov. 29, 2000 Added rs232rx block
// Update: Nov. 30, 2000 Moved contents of "async_tx" and "async_rx" from 
//                       blocks.vhd to this file.
// Update: May   7, 2001 Translated this file from VHDL to verilog, using 
//                       "xhdl"
// Update: May   8, 2001 Since the output of xhdl was rather "spotty", I have
//                       fixed errors and filled in the "holes" in the code.
//                       In addition, I have tried to wean this file from
//                       its previous use and dependency upon "blocks.v"
//                       (also translated from VHDL, but consisting of rather
//                       trivial modules.)
// Update: May   8, 2001 Converted to synchronous resets on all flip-flops.
// Update: May  16, 2001 Re-worked the state machines for rs232rx and rs232tx.
// Update: July 25, 2001 Changed the polarity of q[] in rs232_tx, so that its
//                       output will be the desired (high) level upon initial
//                       FPGA configuration, even before or without a reset!
// Update: Jan. 30, 2002 Corrected the formula in STEP 1: Find the ratio.
//                       (Thanks to Shehryar Shaheen at the University of
//                        Limerick for pointing out the error.)
// Update: June 28, 2002 Fixed "clock_gen" so that it uses the dds_clk.
//
//----------------------------------------
//
// FORMULATING BAUD RATE SETTINGS
//
//
// This ROM contains BAUD rate selection parameters for
// use with the clock_gen_select block.
// The BAUD clocks which are generated are positive pulses,
// (used as clock enables,) and may be used as general clock enables
// if desired.
// Configuring the clock_gen begins with a "Fclk" MHz basic clock.
// To this is applied a prescaler (with value of dds_prescale_value,) 
// followed by a Direct Digital Synthesizer (DDS) frequency
// generator.  The DDS has an accumulator that is "dds_bits" bits wide.
// The user should know that there is some "jitter" introduced by the
// DDS, and that the amount of jitter varies depending upon the desired
// output frequency.  By increasing "dds_bits" the jitter can be made
// very small.  Also, the jitter tends to be smaller for small values of
// "dds_phase_increment"
//
// The following settings apply for these table values:
// rate_select    BAUD rate (16x this is generated)
//----------------------------------------
//     000        9600
//     001        19200
//     010        38400
//     011        57600
//     100        115200
//   (other values are available)
//
//
//
// In order to generate the parameters for a new clock
// frequency, first find the basic Fclk for your board.
// (Fclk=49.152 MHz in this example.)  
// Next, choose the lowest desired BAUD rate.
// (lowest_rate=9600 in this example.)
//
// STEP 1 : Find the ratio
//-------------------------
// First, pick a "clock_factor" for the operation of the rs232 units.
// (16 is traditional, although this hardware supports odd values as
//  well.  For instance, you could pick a clock_factor of 7, if this
//  allows you to generate BAUD rates more exactly from your particular
//  Fclk.  Try to pick the highest clock_factor that you practically can
//  since higher numbers allow the receiver to sample in the middle of
//  the received bit more exactly...  Also, don't go over 16 unless you
//  widen out the counters in the design!)
// So, for this example, let clock_factor=16.
//
// Now, find Fclk/(clock_factor*lowest_rate) = 320 (in this example).
// If this ratio is NOT an integer, then be aware that the
// BAUD rates which you will be able to produce will not be
// exact.  For asynchronous communications, the clock frequency need not
// be exact. (As mentioned in "Brute Force DDS method" below.)
// If you cannot make clocks close enough to the BAUD rates you desire,
// then you can try a different "clock_factor" setting.
// Or, alternately, you could just use the "Brute Force DDS method."
// (See below)
// 
// Or, if all else fails: get a different clock oscillator!
// If the ratio is an integer, or close to it, then proceed to step 2.
//
// Brute Force DDS method (Still step 1):
//-----------------------
// Simply increase the size of the DDS (increase "dds_bits",)
// and set the prescaler to Ndiv=1 (to pass the clock directly
// to the DDS).  Then choose your DDS phase increment values (STEP 3)
// so that you can produce rates which are as close as possible
// to "clock_factor" times the desired BAUD rates.  It might not be exact,
// but it is as close as possible.  If "dds_bits" is sufficiently large,
// then the resulting BAUD rate clocks can be _extremely_ close to the
// correct frequencies.  The Baud rate clocks actually do not need
// to be perfect, they can vary by perhaps 3 or 4 percent from their
// exact frequencies, with an increased risk of bit-errors which result,
// of course.
// 
// The formula is: dds_freq_int = (2^dds_bits)*(desired_frequency)/Fclk.
//
// STEP 2 : Find the prescaler value
//----------------------------------
// If the ratio mentioned in STEP 1 is an integer, then divide that integer
// into its prime factors.  The product of all of the prime factors which
// are not equal to 2 is a good place to start for the prescaler_value.
// If this yields too low of a clock frequency going into the DDS, then
// revert to the "Brute force DDS approach" mentioned above, or else get
// a more suitable clock oscillator!
//
// For this example: 320 = 2*2*2*2*2*2*5.  So the prescaler Ndiv = 5.
//
// If you are lucky and the prime factors are all equal to 2, then you have
// chosen an Fclk which is very agreeable to producing the BAUD clocks.  You
// can probably set Ndiv=1, which disables the prescaler from operating.
//
//
// STEP 3 : Calculate DDS phase increment values
//----------------------------------------------
// Use the following formula:
//    dds_freq_int = (2^dds_bits)*(desired_frequency)/Fclk_dds.
// The resulting values should be used with the DDS, and the values will be
// be "dds_bits-1" wide unsigned quantities.
// Remember that you can change the prescaler Ndiv value to get different
// Fclk_dds values.
//
//=========================================================================





//-----------------------------------------
// This component is a generic clock generator.  Simply connect the appropriate
// inputs, and the desired frequency will be the result.  Output consists of a
// stream of narrow pulses which are one clock wide.  The sizes of DDS and
// prescaler counters are adjustable by parameters.

module clock_gen (
                  clk,
                  reset,
                  frequency,
                  clk_out
                  );

parameter DDS_PRESCALE_NDIV_PP = 5;    // Prescale divide factor
parameter DDS_PRESCALE_BITS_PP = 3;
parameter DDS_BITS_PP  = 6;

input clk;
input reset;
input[DDS_BITS_PP-2:0] frequency;
output clk_out;

// Local signals
wire pulse;
wire dds_clk;

// Simple renaming for readability
wire [DDS_BITS_PP-2:0] dds_phase_increment = frequency; 

reg delayed_pulse;
reg [DDS_PRESCALE_BITS_PP-1:0] dds_prescale_count;
reg [DDS_BITS_PP-1:0] dds_phase;


// This is the DDS prescaler part.  It has a variable divide value.
// The divide factor is "dds_prescale_ndiv".
always @(posedge clk)
begin
  if (reset) dds_prescale_count <= 0;
  else if (dds_prescale_count == (DDS_PRESCALE_NDIV_PP-1))
    dds_prescale_count <= 0;
  else dds_prescale_count <= dds_prescale_count + 1;
end
assign dds_clk = (dds_prescale_count == (DDS_PRESCALE_NDIV_PP-1));
// "dds_prescale_count" above could be compared to zero instead, to save
// on logic?...

// This is the DDS phase accumulator part
always @(posedge clk)
begin
  if (reset) dds_phase <= 0;
  else if (dds_clk) dds_phase <= dds_phase + dds_phase_increment;
end

assign pulse = dds_phase[DDS_BITS_PP-1]; // Simple renaming for readability
// This is "rising edge detector" part
always @(posedge clk)
begin
  delayed_pulse <= pulse;
end
assign clk_out = (pulse && ~delayed_pulse);  // Choose the rising edge

endmodule


//-----------------------------------------
// This component is a clock generator with parameters selected by an
// index into a lookup table.  There are eight possible settings.
// Recalculate the settings for your own needs as described in 
// "FORMULATING BAUD RATE SETTINGS" above.  You will need to change
// the bit width of the DDS registers, according to the `defines.

`define DDS_BITS 6
`define DDS_PRESCALE_BITS 3

module clock_gen_select (
                         clk,
                         reset,
                         rate_select,
                         clk_out
                         );

input clk;
input reset;
input [2:0] rate_select;

output clk_out;

// Local signals
wire pulse;
wire dds_clk;

reg delayed_pulse;
reg [`DDS_PRESCALE_BITS-1:0] dds_prescale_count;
reg [`DDS_PRESCALE_BITS-1:0] dds_prescale_ndiv;
reg [`DDS_BITS-1:0] dds_phase;
reg [`DDS_BITS-2:0] dds_phase_increment;

// This part sets up the "dds_phase_increment" and "dds_prescale_ndiv" values
always @(rate_select)
begin
  case (rate_select)
    3'b000  : begin
                dds_phase_increment <=  1;  // 9600
                dds_prescale_ndiv   <=  5;
              end
              
    3'b001  : begin
                dds_phase_increment <=  2;  // 19200
                dds_prescale_ndiv   <=  5;
              end
              
    3'b010  : begin
                dds_phase_increment <=  4;  // 38400
                dds_prescale_ndiv   <=  5;
              end
              
    3'b011  : begin
                dds_phase_increment <=  6;  // 57600
                dds_prescale_ndiv   <=  5;
              end
              
    3'b100  : begin
                dds_phase_increment <= 12;  // 115200
                dds_prescale_ndiv   <=  5;
              end
              
    3'b101  : begin
                dds_phase_increment <= 12;  // 115200
                dds_prescale_ndiv   <=  5;
              end
              
    3'b110  : begin
                dds_phase_increment <= 12;  // 115200
                dds_prescale_ndiv   <=  5;
              end
              
    3'b111  : begin
                dds_phase_increment <= 12;  // 115200
                dds_prescale_ndiv   <=  5;
              end
              
    default : begin
                dds_phase_increment <= 12;  // 115200
                dds_prescale_ndiv   <=  5;
              end
  endcase 
end 


// This is the DDS prescaler part.  It has a variable divide value.
// The divide factor is "dds_prescale_ndiv" + 1.
always @(posedge clk)
begin
  if (reset) dds_prescale_count <= 0;
  else if (dds_prescale_count == (dds_prescale_ndiv-1))
    dds_prescale_count <= 0;
  else dds_prescale_count <= dds_prescale_count + 1;
end
assign dds_clk = (dds_prescale_count == (dds_prescale_ndiv-1));
// "dds_prescale_count" above could be compared to zero?...

// This is the DDS phase accumulator part
always @(posedge clk)
begin
  if (reset) dds_phase <= 0;
  else if (dds_clk) dds_phase <= dds_phase + dds_phase_increment;
end

assign pulse = dds_phase[`DDS_BITS-1];  // Simple renaming for readability
// This is "rising edge detector" part
always @(posedge clk)
begin
  delayed_pulse <= pulse;
end
assign clk_out = (pulse && ~delayed_pulse);  // Choose the rising edge


endmodule

//`undef DDS_BITS
//`undef DDS_PRESCALE_BITS


//-----------------------------------------
// This block takes care of receiving an RS232 input word,
// from the "rxd" line in a serial fashion.
// The user is responsible for providing appropriate CLK
// and clock enable (CE) to achieve the desired Baudot interval
// (NOTE: the state machine operates at "CLOCK_FACTOR_PP" times the
//   desired BAUD rate.  Set it to anything between 2 and 16,
//   inclusive.  Values higher than 16 will not "buy" much for you,
//   and the state machine might not work well for values less than
//   four either, because of the difficulty in sampling rxd at the
//   "middle" of the bit time.  However, it may be useful to adjust
//   the clock_factor around in order to generate good BAUD clocks
//   from odd Fclk frequencies on your board.)
// Each time the "word_ready" line drives high the unit has put
// a newly received data word into its output buffer, and is possibly
// already in the process of receiving the next one.
// Note that support is not provided for 1.5 stop bits, only integral
// numbers of stop bits are allowed.  However, a selection >2 for
// number of stop bits will still work (it will simply receive
// and count additional stop bits before reporting "word_ready"

module rs232rx (
                clk,
                rx_clk,
                reset,
                rxd,
                read,
                data,
                data_ready,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人免费不卡视频| 国产精品免费免费| 99久久国产综合精品麻豆| 看电视剧不卡顿的网站| 午夜精品久久久久久久| 亚洲精品久久久久久国产精华液| 中文在线资源观看网站视频免费不卡| 26uuu精品一区二区在线观看| 91超碰这里只有精品国产| 欧美日韩国产综合草草| 7777精品伊人久久久大香线蕉| 国产精品网站导航| 久久爱另类一区二区小说| 色欧美88888久久久久久影院| 色狠狠色噜噜噜综合网| 欧美区一区二区三区| 中文字幕一区二| 国产精品灌醉下药二区| 亚洲午夜成aⅴ人片| 日本成人在线一区| 久久国产精品99久久久久久老狼 | 国产在线精品免费| 国产成人自拍高清视频在线免费播放| 成人综合日日夜夜| 欧美成人在线直播| 国产精品福利av| 国产成人av自拍| 久久精品夜夜夜夜久久| 亚洲欧美国产毛片在线| 免费观看久久久4p| av亚洲精华国产精华精| 欧美日本国产一区| 午夜在线成人av| 成人综合婷婷国产精品久久蜜臀| 欧美成人a∨高清免费观看| 日本亚洲三级在线| 日韩三级视频在线看| 国产精品视频免费看| 成人爽a毛片一区二区免费| 国产精品视频一区二区三区不卡| 丰满白嫩尤物一区二区| 337p亚洲精品色噜噜狠狠| 午夜av一区二区| 日韩视频一区二区三区| 激情五月婷婷综合| 在线免费观看不卡av| 国产欧美一区视频| 蜜桃视频一区二区三区在线观看| 91视频一区二区三区| 精品国产三级a在线观看| 亚洲国产精品一区二区www在线| 欧美中文字幕一区| 美女网站色91| 国产日韩精品一区二区浪潮av| 成人亚洲一区二区一| 一区二区三区免费观看| 从欧美一区二区三区| 亚洲欧美中日韩| 精品视频在线免费| 亚洲视频综合在线| 波多野结衣亚洲一区| 一区二区三区不卡视频在线观看| 欧美日高清视频| 国产成人夜色高潮福利影视| 亚洲色图在线看| 日韩视频一区二区三区在线播放 | 精品少妇一区二区三区免费观看 | 日韩精品高清不卡| 欧美专区亚洲专区| 国内精品在线播放| 尤物在线观看一区| 亚洲精品在线网站| 色偷偷88欧美精品久久久| 麻豆中文一区二区| 亚洲另类在线视频| 久久久精品一品道一区| 国产麻豆一精品一av一免费| 伊人夜夜躁av伊人久久| 日韩午夜激情av| 91污在线观看| 国产乱色国产精品免费视频| xvideos.蜜桃一区二区| 在线观看亚洲精品视频| 国产毛片一区二区| 日韩经典中文字幕一区| 日韩毛片一二三区| 久久蜜桃一区二区| 欧美一区二区高清| 国产一区二区三区高清播放| 亚洲v中文字幕| 日韩美女视频一区| 久久久久久一级片| 日韩色在线观看| 欧美久久久一区| 国产乱国产乱300精品| 日韩高清在线电影| 亚洲一区二区欧美日韩| 91麻豆精品国产91久久久久久 | 欧美电视剧免费全集观看| 国内精品在线播放| 日韩制服丝袜先锋影音| 亚洲精品视频在线观看网站| 欧美激情综合在线| 国产夜色精品一区二区av| 欧美变态口味重另类| 欧美一区二区女人| 91麻豆精品国产91久久久| 91久久一区二区| 在线影视一区二区三区| 99久久久国产精品免费蜜臀| 成人手机在线视频| 波波电影院一区二区三区| 高清日韩电视剧大全免费| 国产成人综合自拍| 国产91富婆露脸刺激对白| 国产91丝袜在线播放0| 国产黄色精品视频| 成人午夜精品一区二区三区| 国产成人av电影在线观看| 国产成人精品www牛牛影视| 国产成人日日夜夜| 不卡一区二区在线| 美女mm1313爽爽久久久蜜臀| 免费在线观看视频一区| 精品一区二区在线看| 亚洲男人的天堂av| 亚洲综合成人在线| 日韩专区在线视频| 麻豆精品视频在线观看免费 | 在线不卡一区二区| 欧美一区二区三区免费视频| 欧美成人女星排行榜| 国产无人区一区二区三区| 国产精品国产自产拍高清av王其| 1000部国产精品成人观看| 亚洲综合精品久久| 老司机午夜精品99久久| 国产很黄免费观看久久| 99在线热播精品免费| 欧美日韩国产综合久久| 欧美精品一区二区精品网| 国产精品久久久久永久免费观看 | 欧美电视剧免费全集观看| 欧美国产一区视频在线观看| 国产精品乱码人人做人人爱 | 在线观看国产日韩| 51精品秘密在线观看| 久久在线观看免费| 亚洲精品日韩综合观看成人91| 性欧美疯狂xxxxbbbb| 国产乱人伦精品一区二区在线观看| 成人av网在线| 日韩一区二区视频| 中文字幕中文乱码欧美一区二区| 亚洲成人av中文| 国产成a人亚洲| 91精品国产手机| 亚洲色欲色欲www在线观看| 免费的成人av| 色综合久久久久久久久| 精品国产制服丝袜高跟| 亚洲一区二区三区四区在线免费观看| 老司机一区二区| 欧美自拍丝袜亚洲| 国产精品美日韩| 久久不见久久见中文字幕免费| 色综合久久99| 国产肉丝袜一区二区| 日韩精品三区四区| 91久久精品一区二区二区| 久久亚洲捆绑美女| 天天色天天操综合| 在线中文字幕一区二区| 国产精品久久久久精k8| 久久精品国产99久久6| 在线观看免费亚洲| 国产精品国产三级国产普通话三级 | 欧美日韩你懂得| 国产精品卡一卡二卡三| 国产精品一级片在线观看| 91精品国产丝袜白色高跟鞋| 亚洲最新在线观看| 91老师片黄在线观看| 国产蜜臀av在线一区二区三区| 久久er99热精品一区二区| 777xxx欧美| 亚洲成人精品影院| 在线亚洲高清视频| 亚洲三级在线免费| 白白色 亚洲乱淫| 欧美国产日韩一二三区| 国产美女精品在线| 久久久久久久久一| 国产91丝袜在线观看| 欧美一区二区黄| 免费一区二区视频| 日韩一级高清毛片| 麻豆国产精品官网| 日韩免费视频一区| 久久不见久久见免费视频7 |