Formats code
This commit is contained in:
@@ -11,31 +11,46 @@ class GeneSync extends Module {
|
||||
})
|
||||
|
||||
// Paramètres de synchronisation horizontale et verticale
|
||||
val synchroX = VecInit(Seq(
|
||||
95.U, // HS pulse width
|
||||
47.U, // horizontal back porch
|
||||
639.U, // horizontal display time
|
||||
15.U // horizontal front porch
|
||||
))
|
||||
val synchroX = VecInit(
|
||||
Seq(
|
||||
95.U, // HS pulse width
|
||||
47.U, // horizontal back porch
|
||||
639.U, // horizontal display time
|
||||
15.U // horizontal front porch
|
||||
)
|
||||
)
|
||||
|
||||
val synchroY = VecInit(Seq(
|
||||
1.U, // VS pulse width
|
||||
28.U, // vertical back porch
|
||||
479.U, // vertical display time
|
||||
9.U // vertical front porch
|
||||
))
|
||||
val synchroY = VecInit(
|
||||
Seq(
|
||||
1.U, // VS pulse width
|
||||
28.U, // vertical back porch
|
||||
479.U, // vertical display time
|
||||
9.U // vertical front porch
|
||||
)
|
||||
)
|
||||
|
||||
// Instanciation des compteurs
|
||||
val compteurCLK = Module(new Compteur(3, hasMax = true)) // Compteur horloge (3 bits)
|
||||
val comptX = Module(new Compteur(10, hasEnable = true, hasMax = true)) // Compteur horizontal (10 bits)
|
||||
val comptY = Module(new Compteur(9, hasEnable = true, hasMax = true)) // Compteur vertical (9 bits)
|
||||
val phaseH = Module(new Compteur(2, hasEnable = true)) // Phases horizontales (2 bits)
|
||||
val phaseV = Module(new Compteur(2, hasEnable = true)) // Phases verticales (2 bits)
|
||||
val compteurCLK = Module(
|
||||
new Compteur(3, hasMax = true)
|
||||
) // Compteur horloge (3 bits)
|
||||
val comptX = Module(
|
||||
new Compteur(10, hasEnable = true, hasMax = true)
|
||||
) // Compteur horizontal (10 bits)
|
||||
val comptY = Module(
|
||||
new Compteur(9, hasEnable = true, hasMax = true)
|
||||
) // Compteur vertical (9 bits)
|
||||
val phaseH = Module(
|
||||
new Compteur(2, hasEnable = true)
|
||||
) // Phases horizontales (2 bits)
|
||||
val phaseV = Module(
|
||||
new Compteur(2, hasEnable = true)
|
||||
) // Phases verticales (2 bits)
|
||||
|
||||
// Signaux d'activation
|
||||
val en25 = compteurCLK.io.atMax.get // Activation à 25MHz quand compteurCLK atteint 4
|
||||
val en25 =
|
||||
compteurCLK.io.atMax.get // Activation à 25MHz quand compteurCLK atteint 4
|
||||
val enPhaseH = en25 && comptX.io.atMax.get
|
||||
val enY = enPhaseH && phaseH.io.out === 3.U // Nouvelle ligne
|
||||
val enY = enPhaseH && phaseH.io.out === 3.U // Nouvelle ligne
|
||||
|
||||
// Configuration compteur CLK (divise 125MHz par 5 pour avoir 25MHz)
|
||||
compteurCLK.io.max.get := 4.U
|
||||
@@ -53,11 +68,11 @@ class GeneSync extends Module {
|
||||
phaseV.io.en.get := enY && comptY.io.atMax.get
|
||||
|
||||
// Génération des signaux de sortie
|
||||
io.hsync := phaseH.io.out.orR // true si phaseH != 0 (pas en phase pulse)
|
||||
io.vsync := phaseV.io.out.orR // true si phaseV != 0 (pas en phase pulse)
|
||||
io.img := (phaseH.io.out === 2.U) && (phaseV.io.out === 2.U) // Zone d'affichage
|
||||
io.hsync := phaseH.io.out.orR // true si phaseH != 0 (pas en phase pulse)
|
||||
io.vsync := phaseV.io.out.orR // true si phaseV != 0 (pas en phase pulse)
|
||||
io.img := (phaseH.io.out === 2.U) && (phaseV.io.out === 2.U) // Zone d'affichage
|
||||
|
||||
// Coordonnées pixel
|
||||
io.x := comptX.io.out
|
||||
io.y := comptY.io.out
|
||||
// Coordonnées pixel
|
||||
io.x := comptX.io.out
|
||||
io.y := comptY.io.out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user