Wednesday, October 24, 2007

7bit UART TX Transmitter

module uart_tx (output sd, output busy, input [6:0] data, input wr, rst, clk);
reg [3:0] state, next_state;
reg [9:0] shifter;

parameter S_IDLE = 4'd0, S_BIT_START = 4'd1, S_BIT_P = 4'd9, S_BIT_STOP = 4'd10;

// continuous assignments
assign busy = (state != S_IDLE);
assign sd = shifter[0];

// synchronous behavior(s)
always @ (posedge clk) begin
if(rst) begin
state <= S_IDLE;
shifter <= 10'b11_1111_1111;
else begin
state <= next_state; // update state
if(wr) // load new frame
shifter <= {1'b1, ~(^(data)), data, 1'b0}; // could leave stop bit off!
else // shift current frame
shifter <= {1'b1, shifter[9:1]}; // shift in idle channel
// next state logic
always @ (state, wr) begin
case (state)
if(wr) next_state = S_BIT_START;
else next_state = S_IDLE;
next_state = S_IDLE;
next_state = state + 4'd1;


1 comment:

Anonymous said...

Louisiana is one of the|is among the|is probably certainly one of the} few states that has a selected regulation prohibiting gambling on-line. At the end of the month, New York dismissed the Louisiana warrant. During the Russia-Ukraine struggle, several of} Russian on-line casinos have been accused of focusing on Ukrainian prospects so as to to} sell their knowledge to Russian security services. Online gambling is illegal the law|is unlawful} in the state 1xbet of Maharashtra underneath the "Bombay Wager Act".