A set a scripts to take a design in Verilog and convert it to a factorio blueprint.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.2KB

  1. // test comment
  2. /* test comment */
  3. library(demo) {
  4. type (bus4) {
  5. base_type : array;
  6. data_type : bit;
  7. bit_width : 4;
  8. bit_from : 0;
  9. bit_to : 3;
  10. }
  11. cell(BUF) {
  12. area: 2;
  13. pin(A) { direction: input; }
  14. pin(Y) { direction: output;
  15. function: "A"; }
  16. }
  17. cell(NOT) {
  18. area: 2;
  19. pin(A) { direction: input; }
  20. pin(Y) { direction: output;
  21. function: "A'"; }
  22. }
  23. cell(XOR) {
  24. area: 100;
  25. pin(A) { direction: input; }
  26. pin(B) { direction: input; }
  27. pin(Y) { direction: output;
  28. function: "(A^B)"; }
  29. }
  30. // not used, see -g option of abc http://www.clifford.at/yosys/cmd_abc.html
  31. cell(XORDUAL) {
  32. area: 2;
  33. pin(A) { direction: input; }
  34. pin(B) { direction: input; }
  35. pin(C) { direction: input; }
  36. pin(D) { direction: input; }
  37. pin(Y) { direction: output;
  38. function: "(A^B)"; }
  39. pin(Z) { direction: output;
  40. function: "(C^D)"; }
  41. }
  42. cell(XOR2) {
  43. area: 2;
  44. bus(I1) {
  45. bus_type : bus4;
  46. direction : input;
  47. }
  48. bus(I2) {
  49. bus_type : bus4;
  50. direction : input;
  51. }
  52. bus(Y) {
  53. bus_type : bus4;
  54. direction : output;
  55. pin (Y[0:3]) {
  56. function: "(I1^I2)";
  57. }
  58. }
  59. }
  60. cell(NAND) {
  61. area: 2;
  62. pin(A) { direction: input; }
  63. pin(B) { direction: input; }
  64. pin(Y) { direction: output;
  65. function: "(A*B)'"; }
  66. }
  67. cell(NOR) {
  68. area: 2;
  69. pin(A) { direction: input; }
  70. pin(B) { direction: input; }
  71. pin(Y) { direction: output;
  72. function: "(A+B)'"; }
  73. }
  74. cell(DFF) {
  75. area: 2;
  76. ff(IQ, IQN) { clocked_on: C;
  77. next_state: D; }
  78. pin(C) { direction: input;
  79. clock: true; }
  80. pin(D) { direction: input; }
  81. pin(Q) { direction: output;
  82. function: "IQ"; }
  83. }
  84. cell(DFFSR) {
  85. area: 2;
  86. ff("IQ", "IQN") { clocked_on: C;
  87. next_state: D;
  88. preset: S;
  89. clear: R; }
  90. pin(C) { direction: input;
  91. clock: true; }
  92. pin(D) { direction: input; }
  93. pin(Q) { direction: output;
  94. function: "IQ"; }
  95. pin(S) { direction: input; }
  96. pin(R) { direction: input; }
  97. ; // empty statement
  98. }
  99. }