deepseek is actually quite good at writing XC code

Off topic discussions that do not fit into any of the above can go here. Please keep it clean and respectful.
ycui7
Member
Posts: 14
Joined: Wed Sep 25, 2024 5:46 am

deepseek is actually quite good at writing XC code

Post by ycui7 »

if anyone interested, you should try deepseek to write some XC code. you will be surprised how much better it is than other leading LLM models.

Here is my question to deepseek and it's response.

how to use xmos to generate clocking signal for reading ccd output ?

==below are excerpt of response==
note that deepseek understand concept of port and timer on XMOS chips.

void generate_vertical_clocks() {
timer t;
uint32_t start_time;

while (1) {
t :> start_time; // Read the current time

// Generate V1 and V2 signals
p_v1 <: 1;
p_v2 <: 0;
t when timerafter(start_time + V1_V2_DELAY) :> void; // Wait for the specified delay

p_v1 <: 0;
p_v2 <: 1;
t when timerafter(start_time + 2 * V1_V2_DELAY) :> void; // Wait for the next pulse
}
}
User avatar
infiniteimprobability
Verified
XCore Legend
Posts: 1154
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

That's not too bad. It's got the IO operators and GP timier timing code right. How about if you asked it to use port timers and timed outputs? Getting those right is harder (it wraps if you miss the compare match and you have to be aware of 16b timer instead of 32b) but can provide higher throughput as you can schedule future outputs and unblock the thread whilst it sets up the next one.
Engineer at XMOS