2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

EDIFを書いてみる

Last updated at Posted at 2015-07-31

まずは,

Lチカ...と言いたいところですが,もっとシンプルな「ボタンを押したらLEDを光らせる」から.二つのLEDに対して,一方はボタンを押したら光らせる,もう一方はボタンを押したら消す,というサンプルです.

コード

早速コードです.

myedif_test.edif
(edif myedif_test2
  (edifversion 2 0 0)
  (edifLevel 0)
  (keywordmap (keywordlevel 0))

  (library hdi_primitives
   (edifLevel 0)
   (technology (numberDefinition ))
   (cell GND (celltype GENERIC)
     (view netlist (viewtype NETLIST)
       (interface 
        (port G (direction OUTPUT)))))
   (cell OBUF (celltype GENERIC)
     (view netlist (viewtype NETLIST)
       (interface 
        (port O (direction OUTPUT))
        (port I (direction INPUT)))))
   (cell IBUF (celltype GENERIC)
     (view netlist (viewtype NETLIST)
       (interface 
        (port O (direction OUTPUT))
        (port I (direction INPUT)))))
   (cell VCC (celltype GENERIC)
     (view netlist (viewtype NETLIST)
       (interface 
        (port P (direction OUTPUT)))))
   (cell INV (celltype GENERIC)
     (view netlist (viewtype NETLIST)
       (interface
         (port I (direction INPUT))
         (port O (direction OUTPUT))))))

  (library work
    (edifLevel 0)
    (technology (numberDefinition ))
   (cell myedif_test2 (celltype GENERIC)
     (view myedif_test2 (viewtype NETLIST)
       (interface 
        (port Q0 (direction OUTPUT))
        (port Q1 (direction OUTPUT))
        (port SW (direction INPUT)))
       (contents
         (instance GND (viewref netlist (cellref GND (libraryref hdi_primitives))))
         (instance Q0_OBUF (viewref netlist (cellref OBUF (libraryref hdi_primitives))))
         (instance Q1_OBUF (viewref netlist (cellref OBUF (libraryref hdi_primitives))))
         (instance U_INV_0 (viewref netlist (cellref INV (libraryref hdi_primitives))))
         (instance SW_IBUF (viewref netlist (cellref IBUF (libraryref hdi_primitives))))
         (instance VCC (viewref netlist (cellref VCC (libraryref hdi_primitives))))
         (net Q0 (joined
          (portref O (instanceref Q0_OBUF))
          (portref Q0)))
         (net N0 (joined
          (portref I (instanceref Q0_OBUF))
          (portref O (instanceref SW_IBUF))))
         (net Q1 (joined
          (portref O (instanceref Q1_OBUF))
          (portref Q1)))
         (net N1 (joined
          (portref I (instanceref Q1_OBUF))
          (portref O (instanceref U_INV_0))))
         (net N2 (joined
          (portref I (instanceref U_INV_0))
          (portref O (instanceref SW_IBUF))))
         (net SW (joined
          (portref I (instanceref SW_IBUF))
          (portref SW)))
       ))))
  
  (design myedif_test2 (cellref myedif_test2 (libraryref work)))

)

なんとなく読めますね.

注意点

基本的には(1)ポートとかインスタンスを定義して,(2)それらの間をつないでいく,でよい.ネットの名前は,名前は好きにつけてよいのだけど,ポートに出力するネットはポート名と同じにしておかないとucfでおこられてしまうので注意.

次はLチカやります.CARRYとかFDREとかLUTとか必要なので,一気に複雑になる,はず.

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?