Verilog Adventures
In the past week I have had some free time to do some experimentation. I may as well do some reflection on what I did
Verilog
In short as I am interested in getting into digital electronics, computer architecture and FPGAs, I decided to learn some verilog
Useful links
- https://www.chipverify.com/verilog/verilog-simulation
- An Introduction to Verilog: https://www.youtube.com/watch?v=q1QwC3YlHG0
- Verilog on EDA Playground Starting Tutorial: https://www.youtube.com/watch?v=odjQVpN4aF0
Tools Used
- EDA Playground: https://www.edaplayground.com/
- Icarus Verilog: Just use your package manager to install and follow this https://iverilog.fandom.com/wiki/Getting_Started
Basic concepts
I have made some reference code in here. The main concepts I remembered are
-
Verilog is a Hardware Description Language
- You describe how a digital electronic logic component (a module) functions/ what the schematic is
- You describe a testbench, which connects to the module, runs tests and displays values
-
Behavioural Modelling vs Gate Level Modelling
- Behavioural Modelling : Similar to normal programming, describing how a module functions
- Gate Level Modelling : Describing wires and how gates connect to one another
-
Data Types
-
Basic Data Types
- Wires: To connect Electrical components
- Registers: Controllable bits (0, 1, x(unknown state), z(high impedence))
- Integers, Real and Time (To store simulation time values)
-
Arrays and Vectors
- Arrays: Just like arrays in normal programming languages
- Vectors: A groups of bits (like how 8 bits = 1 byte). You can modify the entire vector at once unlike an array
reg [7:0] reg_vector; reg_vector = 11; // Integer reg_vector = 8'b10001010; // Binary reg_vector = 8'h41; // Hexdata reg_vector [7:4] = 4'h5; // Slicing reg_vector[0] = 0;
-
-
Control Structures
- Building blocks
initial begin {statements} end
- `always @ event begin {statements end}``
posedge _
ornegedge _
: runs only when the value becomes positive or negative
- Behavioural Modelling
- if-else, case statements
- Loops: For loops, while loops
- Building blocks
-
Input Output
$display
to output something to the screen. Can format with variable values.
I may want to revisit this topic to provide a more comprehensive tutorial on verilog, but for now, I'm satisfied with this. I'll probably use it to experiment with my FPGA and stuff
Personal Website Updates
I have made a better CTF Writeup generator, which converts the CTF writeups in my github repository Programming Crappy Solutions
into proper webpages. The idea is to make them more accessible from my website, since I'm churning out many writeups. In short I:
- Used a python program to better tag and extract the writeups from my repository
- Converted them from a Markdown site to HTML webpage
- Put proper formatting, similar to the one on the Github page
I am planning to add more functionality such as
- Maybe add tagging on the related concepts?
- Clean up my repository such that some writeups (for instance, challenges with half done/ incomplete writeups) do not show up
- Make a better search system (Similar to the current blog search system)
- Link the challenges with the CTF
Others
- I'm planning to experiment with Blender Motion Graphics. However, I have no idea what free resources to start with, so maybe I'll look at After Effects Motion Graphics tutorials and then use them in blender
That's it from me today, see you next post!