data/full_repos/permissive/202233324/rtl/better_ascii_input_but_broken.v
data/verilator_xmls/a42c48d2-57d8-4c2c-bcc3-1b76f7eebd93.xml
module ascii_input(
    input       clk25,
    input       rst,
    input       enable,


    input       ioctl_download,

    output      ioctl_wait,
    input [7:0] ioctl_data,
    input [13:0] ioctl_addr,


    input       cs,
    input       address,
    output reg [7:0] dout,
    output  data_ready
);

   assign data_ready=  ascii_rdy | ioctl_download  ;
   reg nextbyte = 0;
	assign ioctl_wait = nextbyte;
   reg [7:0] counter = 0;
	

    reg [7:0]  ascii;
    reg ascii_rdy;
    always @(posedge clk25 or posedge rst)
    begin
        if (rst)
        begin
            ascii_rdy   <= 0;


        end
        else
        begin

              if (!ascii_rdy & ioctl_download  )
              begin
					ascii= ioctl_data;




            	     ascii_rdy   <= 1;
                    nextbyte = 1;
						  counter = 0;

              end




              if (cs == 1'b1  )
              begin
                if (address == 1'b0 )
                begin


                    dout <= {1'b1, ascii[6:0]};
                    ascii_rdy <= 1'b0;
						  counter = counter +1;
						  if (counter==8) nextbyte=0;

 $display("ascii send %x %x",dout,enable);


                end
                else
                begin

                    dout <= {ascii_rdy, 7'b0};

                end
              end
           
        end
     end

endmodule
module ascii_input(
    input       clk25,
    input       rst,
    input       enable,


    input       ioctl_download,

    output      ioctl_wait,
    input [7:0] ioctl_data,
    input [13:0] ioctl_addr,


    input       cs,
    input       address,
    output reg [7:0] dout,
    output  data_ready
);


   assign data_ready=  ascii_rdy | ioctl_download  ;
   reg nextbyte = 0;
	assign ioctl_wait = nextbyte;
   reg [7:0] counter = 0;
	

    reg [7:0]  ascii;
    reg ascii_rdy;
    always @(posedge clk25 or posedge rst)
    begin
        if (rst)
        begin
            ascii_rdy   <= 0;


        end
        else
        begin

              if (!ascii_rdy & ioctl_download  )
              begin
					ascii= ioctl_data;




            	     ascii_rdy   <= 1;
                    nextbyte = 1;
						  counter = 0;

              end




              if (cs == 1'b1  )
              begin
                if (address == 1'b0 )
                begin


                    dout <= {1'b1, ascii[6:0]};
                    ascii_rdy <= 1'b0;
						  counter = counter +1;
						  if (counter==8) nextbyte=0;

 $display("ascii send %x %x",dout,enable);


                end
                else
                begin

                    dout <= {ascii_rdy, 7'b0};

                end
              end
           
        end
     end

endmodule