-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor stepmotor fixes and initial testbench
- Loading branch information
Showing
11 changed files
with
263 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
vlib workstart | ||
|
||
#compila projeto: todos os aquivo. Ordem é importante | ||
vcom stepmotor.vhd tb_stepmotor.vhd | ||
|
||
#Simula (work é o diretorio, testbench é o nome da entity) | ||
vsim -t ns work.tb_stepmotor | ||
|
||
#Mosta forma de onda | ||
view wave | ||
|
||
#Adiciona ondas específicas | ||
# -radix: binary, hex, dec | ||
# -label: nome da forma de onda | ||
add wave -radix binary -label clk /clk | ||
add wave -radix binary -label reverse /reverse | ||
add wave -radix binary -label reset /rst | ||
add wave -radix binary -label stop /stop | ||
add wave -radix binary -label enable /ena | ||
add wave -radix binary -label half_full /half_full | ||
add wave -radix unsigned -label speed /speed | ||
add wave -radix binary -label output /outputs | ||
add wave -label state /motor0/state | ||
|
||
#Simula até 500ms | ||
run 500ms | ||
|
||
wave zoomfull |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
--! Bibliotecas !-- | ||
library ieee; --! Biblioteca padrão | ||
use ieee.std_logic_1164.all; --! Elementos lógicos | ||
use ieee.numeric_std.all; --! Conversões entre tipos | ||
|
||
entity tb_stepmotor is | ||
end entity tb_stepmotor; | ||
|
||
|
||
architecture RTL of tb_stepmotor is | ||
signal clk, reverse, rst, stop,ena : std_logic; | ||
signal half_full : std_logic; | ||
signal in1: std_logic; | ||
signal in2: std_logic; | ||
signal in3: std_logic; | ||
signal in4: std_logic; | ||
signal speed : unsigned(2 downto 0); | ||
signal outputs: std_logic_vector(3 downto 0); -- @suppress "signal outputs is never read" | ||
begin | ||
outputs(0) <= in1; outputs(1) <= in2; | ||
outputs(2) <= in3; outputs(3) <= in4; | ||
|
||
motor0: entity work.stepmotor | ||
port map( | ||
clk => clk, | ||
reverse => reverse, | ||
rst => rst, | ||
stop => stop, | ||
ena => ena, | ||
half_full => half_full, | ||
in1 => in1, | ||
in2 => in2, | ||
in3 => in3, | ||
in4 => in4, | ||
speed => speed | ||
); | ||
|
||
clk0: process is | ||
begin | ||
clk <= '0'; | ||
wait for 1 ms; | ||
clk <= '1'; | ||
wait for 1 ms; | ||
end process clk0; | ||
|
||
en0: process is | ||
begin | ||
ena <= '0'; | ||
wait for 6 ms; | ||
ena <= '1'; | ||
wait; | ||
end process en0; | ||
|
||
speed0: process is | ||
begin | ||
rst <='0'; | ||
stop <='0'; | ||
speed <= to_unsigned(0, speed'length); | ||
wait for 140 ms; | ||
stop <= '1'; | ||
wait for 10 ms; | ||
stop <= '0'; | ||
rst <= '1'; | ||
wait for 2 ms; | ||
rst <= '0'; | ||
for i in 0 to 7 loop | ||
speed <= to_unsigned(i, speed'length); | ||
wait for 20 ms; | ||
end loop; | ||
wait; | ||
end process speed0; | ||
|
||
hf0: process is | ||
begin | ||
half_full <= '0'; | ||
wait for 140 ms; | ||
half_full <= '1'; | ||
wait for 140 ms; | ||
half_full <= '0'; | ||
wait; | ||
end process hf0; | ||
|
||
rev0: process is | ||
begin | ||
reverse <= '0'; | ||
wait for 70 ms; | ||
reverse <= '1'; | ||
wait for 140 ms; | ||
reverse <= '0'; | ||
wait; | ||
end process rev0; | ||
|
||
end architecture RTL; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
m255 | ||
K4 | ||
z2 | ||
!s11e MIXED_VERSIONS | ||
13 | ||
!s112 1.1 | ||
!i10d 8192 | ||
!i10e 25 | ||
!i10f 100 | ||
cModel Technology | ||
Z0 dC:/Users/rayan/Documents/GitHub/riscv-multicycle/peripherals/step_motor | ||
Estepmotor | ||
Z1 w1631411376 | ||
Z2 DPx4 ieee 11 numeric_std 0 22 aU^R8eGcicLcUFIaBQSL>3 | ||
Z3 DPx3 std 6 textio 0 22 zE1`LPoLg^DX3Oz^4Fj1K3 | ||
Z4 DPx4 ieee 14 std_logic_1164 0 22 cVAk:aDinOX8^VGI1ekP<3 | ||
!i122 6 | ||
R0 | ||
Z5 8stepmotor.vhd | ||
Z6 Fstepmotor.vhd | ||
l0 | ||
L10 1 | ||
VRGa4cnclWom;dB=?6`1_[2 | ||
!s100 FEW6>`>5==XejOdSi0F:e3 | ||
Z7 OV;C;2021.1;73 | ||
32 | ||
Z8 !s110 1631411930 | ||
!i10b 1 | ||
Z9 !s108 1631411930.000000 | ||
Z10 !s90 -reportprogress|300|stepmotor.vhd|tb_stepmotor.vhd| | ||
Z11 !s107 tb_stepmotor.vhd|stepmotor.vhd| | ||
!i113 1 | ||
Z12 tExplicit 1 CvgOpt 0 | ||
Artl | ||
R2 | ||
R3 | ||
R4 | ||
Z13 DEx4 work 9 stepmotor 0 22 RGa4cnclWom;dB=?6`1_[2 | ||
!i122 6 | ||
l30 | ||
Z14 L24 127 | ||
Z15 VBl?O0?m]IWiU;Qai@;FXf2 | ||
Z16 !s100 >Ak`S;8YIlFC]QOIH_1WS2 | ||
R7 | ||
32 | ||
R8 | ||
!i10b 1 | ||
R9 | ||
R10 | ||
R11 | ||
!i113 1 | ||
R12 | ||
Etb_stepmotor | ||
Z17 w1631411894 | ||
R2 | ||
R3 | ||
R4 | ||
!i122 6 | ||
R0 | ||
Z18 8tb_stepmotor.vhd | ||
Z19 Ftb_stepmotor.vhd | ||
l0 | ||
L6 1 | ||
VKFJBX=L65oZ:V>6naD>?m3 | ||
!s100 PgVCU]oKP[5AgP=`B0g6T0 | ||
R7 | ||
32 | ||
R8 | ||
!i10b 1 | ||
R9 | ||
R10 | ||
R11 | ||
!i113 1 | ||
R12 | ||
Artl | ||
R13 | ||
R2 | ||
R3 | ||
R4 | ||
Z20 DEx4 work 12 tb_stepmotor 0 22 KFJBX=L65oZ:V>6naD>?m3 | ||
!i122 6 | ||
l19 | ||
L10 84 | ||
VbDU5X>4bPnn2oH6:SI>m[1 | ||
!s100 l9FUkimFLh^z2]fP[QNb]2 | ||
R7 | ||
32 | ||
R8 | ||
!i10b 1 | ||
R9 | ||
R10 | ||
R11 | ||
!i113 1 | ||
R12 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
m255 | ||
K4 | ||
z0 | ||
cModel Technology |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
m255 | ||
K4 | ||
z2 | ||
13 | ||
!s112 1.1 | ||
!i10d 8192 | ||
!i10e 25 | ||
!i10f 100 | ||
cModel Technology | ||
dC:/Users/rayan/Documents/GitHub/riscv-multicycle/peripherals/step_motor |