File tree Expand file tree Collapse file tree 2 files changed +49
-2
lines changed
Expand file tree Collapse file tree 2 files changed +49
-2
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,13 @@ clean:
2424
2525test-api :
2626 @echo " Testing API endpoint..."
27- @curl -X POST http://localhost:8080/api/compile \
27+ @jq -n --rawfile verilog test/tt_um_factory_test.v \
28+ ' {sources: {"project.v": $$verilog}, topModule: "tt_um_factory_test"}' | \
29+ curl -s -X POST http://localhost:8080/api/compile \
2830 -H " Content-Type: application/json" \
29- -d ' {"sources":{"project.v":"module tt_um_test(input clk, output led); reg r; always @(posedge clk) r <= ~r; assign led = r; endmodule"},"topModule":"tt_um_test"}'
31+ -d @- > /tmp/test-api-response.txt
32+ @echo " Validating response..."
33+ @grep -q ' ^data: ' /tmp/test-api-response.txt || (echo " ERROR: No events received from API" && exit 1)
34+ @grep -q ' "type":"success"' /tmp/test-api-response.txt || (echo " ERROR: No success event found" && exit 1)
35+ @grep -q ' "data":"base64:' /tmp/test-api-response.txt || (echo " ERROR: No base64 bitstream found" && exit 1)
36+ @echo " ✓ Test passed: API returned success with bitstream"
Original file line number Diff line number Diff line change 1+ /*
2+ * tt_um_factory_test.v
3+ *
4+ * Test user module
5+ *
6+ * Author: Sylvain Munaut <tnt@246tNt.com>
7+ */
8+
9+ `default_nettype none
10+
11+ module tt_um_factory_test (
12+ input wire [7 :0 ] ui_in, // Dedicated inputs
13+ output wire [7 :0 ] uo_out, // Dedicated outputs
14+ input wire [7 :0 ] uio_in, // IOs: Input path
15+ output wire [7 :0 ] uio_out, // IOs: Output path
16+ output wire [7 :0 ] uio_oe, // IOs: Enable path (active high: 0=input, 1=output)
17+ input wire ena, // always 1 when the design is powered, so you can ignore it
18+ input wire clk, // clock
19+ input wire rst_n // reset_n - low to reset
20+ );
21+
22+ reg rst_n_i;
23+ reg [7 :0 ] cnt;
24+
25+ always @(posedge clk or negedge rst_n)
26+ if (~ rst_n) rst_n_i <= 1'b0 ;
27+ else rst_n_i <= 1'b1 ;
28+
29+ always @(posedge clk or negedge rst_n_i)
30+ if (~ rst_n_i) cnt <= 0 ;
31+ else cnt <= cnt + 1 ;
32+
33+ assign uo_out = ~ rst_n ? ui_in : ui_in[0 ] ? cnt : uio_in;
34+ assign uio_out = ui_in[0 ] ? cnt : 8'h00 ;
35+ assign uio_oe = rst_n && ui_in[0 ] ? 8'hff : 8'h00 ;
36+
37+ // avoid linter warning about unused pins:
38+ wire _unused_pins = ena;
39+
40+ endmodule // tt_um_factory_test
You can’t perform that action at this time.
0 commit comments