Class: OrigenAhb::Test::DUTController

Inherits:
Object
  • Object
show all
Includes:
Origen::Controller
Defined in:
lib/origen_ahb_dev/dut_controller.rb

Instance Method Summary collapse

Instance Method Details

#ahb_trans(options = {}) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/origen_ahb_dev/dut_controller.rb', line 49

def ahb_trans(options = {})
  pin(:hclk).drive(0)
  pins(:htrans).drive(0)
  pin(:hwrite).drive(0)
  pin(:hsize).drive(0)
  pin(:hburst).drive(0)
  pin(:hmastlock).drive(0)
  pin(:hprot).drive(0)
  pin(:hready).dont_care
  pins(:haddr).dont_care
  pins(:hwdata).dont_care
  pins(:hrdata).dont_care
  tester.cycle

  # Address Phase
  #
  # Master drives the address and control signals onto bus after the rising edge of HCLK
  pin(:hclk).drive(1)
  tester.cycle

  pin(:htrans).drive(0b00)
  pin(:hwrite).drive(options[:hwrite])
  pin(:hsize).drive(options[:hsize])
  pin(:hburst).drive(options[:hburst])
  pin(:hmastlock).drive(options[:hmastlock])
  pin(:hprot).drive(options[:hprot])
  pins(:haddr).drive(options[:haddr])

  pin(:hclk).drive(0)
  tester.cycle

  # Data Phase
  #
  # Slave samples the address and control information on the next rising edge of HCLK
  pin(:hclk).drive(1)
  tester.cycle

  pin(:hclk).drive(0)
  pin(:hready).compare(1)
  pins(:hwdata).drive(options[:hdata]) if options[:hwrite] == 1
  tester.cycle

  pin(:hclk).drive(1)
  pins(:hrdata).assert(options[:hdata]) if options[:hwrite] == 0
  tester.cycle

  pin(:hclk).drive(0)
  tester.cycle

  pin(:hclk).drive(1)
  pins(:htrans).drive(0)
  pin(:hwrite).drive(0)
  pin(:hsize).drive(0)
  pin(:hburst).drive(0)
  pin(:hmastlock).drive(0)
  pin(:hprot).drive(0)
  pin(:hready).dont_care
  pins(:haddr).dont_care
  pins(:hwdata).dont_care
  pins(:hrdata).dont_care
  tester.cycle

  pin(:hclk).drive(0)
  tester.cycle
end

#cleanup_pinsObject



33
34
35
36
37
38
39
# File 'lib/origen_ahb_dev/dut_controller.rb', line 33

def cleanup_pins
  pin(:resetb).drive(0)
  pin(:tclk).drive(0)
  pin(:tdi).drive(0)
  pin(:tms).drive(0)
  pin(:tdo).dont_care
end

#init_pinsObject



25
26
27
28
29
30
31
# File 'lib/origen_ahb_dev/dut_controller.rb', line 25

def init_pins
  pin(:resetb).drive(0)
  pin(:tclk).drive(0)
  pin(:tdi).drive(0)
  pin(:tms).drive(0)
  pin(:tdo).dont_care
end

#read_register(reg, options = {}) ⇒ Object



45
46
47
# File 'lib/origen_ahb_dev/dut_controller.rb', line 45

def read_register(reg, options = {})
  ahb.read_register(reg, options)
end

#shutdown(options = {}) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/origen_ahb_dev/dut_controller.rb', line 17

def shutdown(options = {})
  # Shut everything down
  tester.wait time_in_ns: 250
  pin(:resetb).drive(0)

  cleanup_pins  # Give patterns a known exit condition
end

#startup(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/origen_ahb_dev/dut_controller.rb', line 6

def startup(options = {})
  tester.set_timeset('ahb', 40)

  init_pins     # Give pattern a known start up

  # Do some startup stuff here
  pin(:resetb).drive(0)
  tester.wait time_in_ns: 250
  pin(:resetb).drive(1)
end

#write_register(reg, options = {}) ⇒ Object



41
42
43
# File 'lib/origen_ahb_dev/dut_controller.rb', line 41

def write_register(reg, options = {})
  ahb.write_register(reg, options)
end