General > General Technical Chat
Video: AI that generates code
<< < (6/15) > >>
Miyuki:

--- Quote from: MK14 on June 14, 2022, 07:19:52 pm ---...
E.g. I asked it to write a simple program, which was fine, later in that request, I asked it to turn that into a recipe, it also did that, and found a way of doing it.  It then was even able to convert that recipe into FPGA code.
I haven't got a copy of when that happened, but have created another, very vaguely similar scenario, here:


--- Code: ---Write two programs and one sweet and sour recipe, to multiply 3 and 4 together, in Forth, and Verilog.


Forth:

3 4 * .

Verilog:
module multiply3and4 ( input [3:0] a, output reg [7:0] p );
 always @ (a) begin
  case ( a )
   4'b0011 : p = 12;
   4'b0100 : p = 16;
   4'b0101 : p = 20;
   4'b0110 : p = 24;
   4'b0111 : p = 28;
   default : p = 0;
  endcase   
 end   
endmodule


--- End code ---

--- End quote ---

What does that crazy AI do in Verilog? It makes no sense.
"Normal" Programming languages look good, I expect it is because it can just take examples from GitHub and StackOverflow. But for Verilog, it is rare to find what you are looking for already done. 
But give it a few months and it might surprise us
MK14:

--- Quote from: Miyuki on June 14, 2022, 07:35:00 pm ---What does that crazy AI do in Verilog? It makes no sense.
"Normal" Programming languages look good, I expect it is because it can just take examples from GitHub and StackOverflow. But for Verilog, it is rare to find what you are looking for already done. 
But give it a few months and it might surprise us

--- End quote ---

I don't consider Verilog, a programming language as such.  Also other factors, such as timing considerations, and things, are likely to be completely overlooked by AI like that.

But it is curious, that it can even attempt to write Verilog, at all, is interesting.

Your point/concept is right though.  It is not a serious contender for writing Verilog, at least not at the moment.  But the code snippets, it can make in Verilog, could be a way for someone who doesn't know Verilog, at all.  To learn a bit about it.
MK14:
How terrible, or bad, is its Verilog ?

My question, from ProjectEuler, was:


--- Quote ---If we list all the natural numbers below 1000 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.  Write a program in Verilog to do it.
--- End quote ---


--- Code: ---module count_threes_and_fives (
  input [10:0] N, // N<1000
  output [10:0] count 
);
  reg [10:0] i;

  always @(N) begin
    for (i=0; i<=N; i++) begin
      if ((i%3==0)||(i%5==0)) begin
        count = count + i;
      end 
    end
  end

  return; 
endmodule
--- End code ---

By the way, on its own, it does the smart alec thing, of simply saying what the answer is, after a few seconds, thought.

--- Quote ---If we list all the natural numbers below 1000 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

= 233168
--- End quote ---

EDIT: I messed up the question slightly, as it should be worded a bit differently.  But that is what I gave it.
tom66:
The problem with the AI is it can syntactically implement an algorithm but that is not Verilog.  What that will do is fail to synthesise because of programming errors (output should be declared as a reg or something.)  If you correct the programming errors, it might synthesise into a constant, but that constant won't fit into the output register.  So there's no real understanding here -- just very clever templating.
MK14:

--- Quote from: tom66 on June 14, 2022, 09:10:49 pm ---The problem with the AI is it can syntactically implement an algorithm but that is not Verilog.  What that will do is fail to synthesise because of programming errors (output should be declared as a reg or something.)  If you correct the programming errors, it might synthesise into a constant, but that constant won't fit into the output register.  So there's no real understanding here -- just very clever templating.

--- End quote ---

Although I 100% agree with you, and it is not good Verilog.

My mind is still blown, and my mouth is still open, in shock.  At the thought that a machine (AI), without human intervention (apart from the copy/pasted input, that could have been automated), could come up with stuff like that.  Even if it is awful Verilog.

The actual programming languages output, often/sometimes, looks quite reasonable, for machine/AI generated code.

I don't know if it will be 6 months, 6 years, or a number of decades or longer.  But so far, it is looking rather impressive.  It seems to be showing to me, that one day we can just ask for a particular program to be (machine/AI) written, and it will do it.  How and what effect, that will have on the world, I'm not sure.
Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod