-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathjtag_counter.c
53 lines (45 loc) · 1.51 KB
/
jtag_counter.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// Author (C version): Wolfgang Spraul
// Author (Verilog version): Xiangfu Liu
//
// This is free and unencumbered software released into the public domain.
// For details see the UNLICENSE file at the root of the source tree.
//
#include "model.h"
#include "floorplan.h"
#include "control.h"
/*
This C design corresponds to the following Verilog:
TODO
*/
int main(int argc, char** argv)
{
struct fpga_model model;
const char *param_clock_pin, *param_led_pin;
int iob_clk_y, iob_clk_x, iob_clk_type_idx;
int iob_led_y, iob_led_x, iob_led_type_idx;
if (cmdline_help(argc, argv)) {
printf("\n");
return 0;
}
if (!(param_clock_pin = cmdline_strvar(argc, argv, "clock_pin")))
param_clock_pin = "IO_L30N_GCLK0_USERCCLK_2";
if (!(param_led_pin = cmdline_strvar(argc, argv, "led_pin")))
param_led_pin = "IO_L48P_D7_2";
fpga_build_model(&model, cmdline_part(argc, argv),
cmdline_package(argc, argv));
fpga_find_iob(&model, xc6_find_pkg_pin(model.pkg, param_clock_pin),
&iob_clk_y, &iob_clk_x, &iob_clk_type_idx);
fdev_iob_input(&model, iob_clk_y, iob_clk_x, iob_clk_type_idx,
IO_LVCMOS33);
fpga_find_iob(&model, xc6_find_pkg_pin(model.pkg, param_led_pin),
&iob_led_y, &iob_led_x, &iob_led_type_idx);
fdev_iob_output(&model, iob_led_y, iob_led_x, iob_led_type_idx,
IO_LVCMOS25);
fdev_iob_slew(&model, iob_led_y, iob_led_x, iob_led_type_idx,
SLEW_QUIETIO);
fdev_iob_drive(&model, iob_led_y, iob_led_x, iob_led_type_idx,
8);
write_floorplan(stdout, &model, FP_DEFAULT);
return fpga_free_model(&model);
}