Mistral-7B Fine-tuned for SystemVerilog AHB2APB Bridge Design
Model Description
This is a LoRA fine-tuned Mistral-7B-v0.1 model specialized in generating complete, production-ready SystemVerilog code for AHB2APB bridge designs. The model was trained on comprehensive bridge specifications following Einnnos Systems design standards.
Model Type: Causal Language Model (LoRA Adapter) Base Model:mistralai/Mistral-7B-v0.1 Training Date: 2025-11-20 Organization: Einnnos Systems Pvt Limited
Key Features
✅ Complete Code Generation - Generates full SystemVerilog modules with proper closures
✅ Verification Integration - Includes SystemVerilog assertions and functional coverage
✅ Protocol Compliance - AMBA AHB-Lite and APB protocol compliant
✅ Hallucination Control - Trained with end markers to reduce unwanted output (~75% reduction)
✅ Production-Ready - Synthesizable, documented, and follows industry best practices
Training Details
Dataset
Training Samples: 127
Validation Samples: 32
Dataset Features:
Complete responses with verification code
Enhanced instructions (3,700 chars avg) with detailed specifications
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
45# Load base model with 4-bit quantization6base_model = AutoModelForCausalLM.from_pretrained(7"mistralai/Mistral-7B-v0.1",8 torch_dtype=torch.bfloat16,9 device_map="auto",10 load_in_4bit=True,11)1213# Load fine-tuned adapter14model = PeftModel.from_pretrained(15 base_model,16"Elinnos/mistral-7b-elip-bridge-final-v1"17)1819# Load tokenizer20tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")21if tokenizer.pad_token isNone:22 tokenizer.pad_token = tokenizer.eos_token
2324# Create prompt25prompt ="""### Instruction:
26You are an expert IP designer at Einnnos Systems Pvt Limited. You specialize in digital design, RTL coding, and verification. Your task is to design a production-ready hardware component following industry best practices and Einnnos Systems' design guidelines.
2728## Design Requirements:
2930**Component:** AHB to APB Bridge
31**Purpose:** Protocol conversion between AMBA AHB and APB
3233**Specifications:**
34- Number of APB Slaves: 8 independent peripherals
35- Data Width: 32 bits
36- Address Width: 32-bit AHB, 12-bit APB per slave
37- Protocol: AHB-Lite to APB bridge (AMBA 3.0 compliant)
3839Design a complete AHB2APB bridge supporting 8 APB slaves with address decoding and response multiplexing. Provide complete, synthesizable SystemVerilog code.
4041### Response:
42"""4344# Generate45inputs = tokenizer(prompt, return_tensors="pt").to(model.device)46outputs = model.generate(47**inputs,48 max_new_tokens=4000,49 temperature=0.7,50 do_sample=True,51 pad_token_id=tokenizer.eos_token_id,52)5354result = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)5556# Post-process: Remove end marker if present57if"### End of Response ###"in result:58 result = result.split("### End of Response ###")[0]5960print(result)