Skip to content

Commit

Permalink
This verilog implementation is now fully functional. I suggest you us…
Browse files Browse the repository at this point in the history
…e it.
  • Loading branch information
lkolbly committed May 11, 2016
1 parent 6478a59 commit 9d2cbe0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions verilog/sa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ Then we try swaps. When we try swaps, observe that we don't have to re-compute t

The temperature schedule is: Start at a given temperature, multiply it each iteration by a constant value (about 0.9999999). Since we only ever divide by T (and division is super expensive - over 30 cycles!), we start at a given 1/T, and multiply it each iteration by 1/factor (about 1.0000001).

However, we still have to do a reciprocal, and thus the latency of each iteration is on the order of a hundred cycles. Since iterations aren't pipelined (yet), the throughput is about 1 per 100 cycles.
However, we still have to do a reciprocal, and thus the latency of each iteration is on the order of a hundred cycles. Since iterations aren't pipelined (yet), the throughput is about 1 per 30 cycles, depending on how often it computes negexp.

But, for all of these problems, this code used to fit onto the Mojo chip. Post-translate it uses 157% of the LUTs, and map takes several hours so hopefully it'll fit. We'll see.
But, for all of these problems, this code actually fits on a Mojo chip, so that's pretty cool.
5 changes: 2 additions & 3 deletions verilog/sa/src/mojo_top.v
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ always @(*) begin
if (best_distance_valid || cntdown_q == 0) begin
printval_d = best_distance;
digit_cnt_d = 8;
tx_data_d = "\n";
tx_data_d = "\r";
tx_new_data_d = 1;
cntdown_d = 100000000;
end
Expand All @@ -137,8 +137,7 @@ always @(posedge clk) begin
end
end

assign led = best_distance[7:0];//exp_debug;//floatval[7:0];//rng_out[7:0];//{tx_busy, printval_q[6:0]};
//assign led = exp_res[7:0];
assign led = best_distance[15:8];

// these signals should be high-z when not used
assign spi_miso = 1'bz;
Expand Down
7 changes: 1 addition & 6 deletions verilog/sa/src/tsp.v
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,8 @@ reg [PRECISION*2-1:0] city1_q, city1_d, city2_q, city2_d, city3_q, city3_d, city
`define X(v) (v[PRECISION-1:0])
`define Y(v) (v[PRECISION*2-1:PRECISION])

assign debug = {2'b0, total_dist_q[5:0]};//total_dist_q[7:0];//string_len_q;//{state_q[2:0], has_read_prolog_q, nextstate_q[2:0], 1'b0};//nnodes_in_file_q[7:0];//((read_string_q>>((string_len_q-1)*8))&8'hFF);//{string_len_q[3:0],nnodes_in_file_q[3:0]};
assign debug = nnodes_in_file_q[7:0];

//reg [PRECISION-1:0] dx_q, dx_d, dy_q, dy_d;
//wire [PRECISION-1:0] dx, dy, dist_squared;
//assign dx = `X(doutb)-`X(douta);
//assign dy = `Y(doutb)-`Y(douta);
//assign dist_squared = dx*dx + dy*dy;
reg [2:0] pipe_tx_ctr_q, pipe_tx_ctr_d, pipe_rx_ctr_q, pipe_rx_ctr_d;
reg [PRECISION*4*2-1:0] pipe_tx_buf_a_q, pipe_tx_buf_a_d, pipe_tx_buf_b_q, pipe_tx_buf_b_d;
reg [PRECISION*4-1:0] pipe_rx_buf_q, pipe_rx_buf_d;
Expand Down

0 comments on commit 9d2cbe0

Please sign in to comment.